WordPress Development Best Practices
I regularly review and develop WordPress plugins and I noticed that a lot of people are not aware of WordPress development best practices, so I decided to start developing a section on my site outlining them.
You can also view these best practices by tag:
Admin Core FrontendSeparating frontend and admin code
In most cases, your plugin has stuff it needs to do in the admin area. It probably also has stuff it needs to do in the frontend. These two never happen at the same time, so you can actually separate the two. The easiest way of separating frontend and backend code is having a set [...]
Optional Styles
A WordPress plugin or theme should never have to output inline styles, especially not in the frontend. Inline styles will prevent some doctypes from validating and they are actually a factor to slow down your page loads. If your plugin outputs a piece of code that needs styling, add an ID to the output and [...]
Using a namespace for your functions and classes
An often made mistake by WordPress developers is to use to generic function and class names. For instance, if you’re building a plugin to do with YouTube, using a class name “Youtube” is bound to cause issues: if a user has multiple plugins dealing with Youtube, he or she could very well end up with [...]
WordPress HTTP API
Why you should want to know about the WordPress HTTP API? Well, some WordPress installs may have CURL installed for instance, others may not. On some installs you’re allowed to do file_get_contents to external URLs, on others you’re not. If you’re relying on these features to work, your plugin might not work for a lot [...]
