http://wordpress.stackexchange.com/a/55410/1014
Tag: WordPress (Page 218 of 220)
Articles, tips, and resources for WordPress-based development.
When building custom functionality into WordPress, it’s important to make sure that you’re properly sanitizing data. WordPress provides an array of utility functions for doing this.
But there are times when completely sanitizing the input may be too much. For example, say you’re working on a widget that has a text field and you’re comfortable with allowing the user to input styles and markup but want to remove any JavaScript. Using strip_tags and strip_slashes is overkill, obviously. These would reduce the input into nothing but the raw text.
Here’s a simple way to removing JavaScript tags from input fields while still supporting inline CSS and HTML markup:
As a developer, one of the challenges of working with WordPress as a platform is that finding information isn’t always easy. Sure, the Codex is a fantastic resource, but it lacks in a few areas.
On the other hand, it’s relatively easy to google for examples on how to do almost anything you’d like with WordPress, but these examples can often be of poor quality – just because something works doesn’t mean that it’s done correctly.
As I begin to shift my focus to talking more about WordPress development, I hope to be able to share a few thoughts on how to achieve certain tasks using the best practices with the WordPress API.
In recent weeks, I’ve been doing a fair amount of work using the WordPress Ajax API, so that seemed like a good place to start.
I’ve begun using PHPUnit, WordPress, and MAMP to introduce unit testing to my theme and plugin development. Obviously, this requires an installation of PHPUnit and the WordPress testing framework. Because I use MAMP for local development, I had to do some additional customization to get the frameworks setup.
Here are the steps necessary to install PHPUnit and the WordPress Tests on Mac OS X using MAMP:
http://wp.tutsplus.com/tutorials/creative-coding/data-sanitization-and-validation-with-wordpress/
