WordPress Code Snippets

A fresh mix of code snippets and tutorials

PHP String Cleaner


Here is a PHP snippet for cleaning or sanitizing variables.

This function works great for removing unwanted characters from PHP variables. For example, if you’re using WordPress, you can add this function to your theme’s functions.php file:

Then use it anywhere in your theme to clean up input and other variables. For example, if you wanted to catch the current user-agent:

And so on and so forth :)

Show Support

Like our new Facebook Page to show support!