Every second of every day, 17WordPress posts are published and the installations running those posts are able to scale well beyond the factory settings of the platform due to the 34,000 plugin library that power it.
While many programmers focus on creating from scratch to work in successful website design and/or development firms, there is another really great perk when it comes to WordPress plugins; they allow their creator to live on a passive income. And to add to the allure, 25% of all WordPress users make a full-time living on it.
WordPress development is one of the most attractive programming gigs education can buy, and with websites like Code Academy and others, learning to code need not cost a penny.
However with so much hype and demand, the WordPress plugin development community is full of “noobs” who are just starting out, eager to make that next big plugin. And without filling gaps in understanding,it makes it harder than it needs to be in the beginning.
With that in mind, we’ve compiled our list of the most important knowledge bytes that all WordPress plugin developers should know right off the cuff.
1. Never Edit the Core
Simply put, if you edit the WordPress core files they will likely be wiped out with the next core update, and many WordPress installations are set to automatically update. Unless you plan to displease your client, it is suggested that you create a “child theme” and edit that instead. This way neither WordPress core update nor theme update, can inflict any undesired behaviour from the website you are currently working on.
2. Understand the Difference between Action Hooks and Filters
Action hooks are specific points within the code that allow you to safely call upon and initialize other strings of code; initializing custom code prior to an action hook could make for strange behaviour when it outputs. This is because action hooks are present after the core software has already been loaded. If the core software can’t load all of its required libraries first, you may “break” your website project.
On the other hand, filters catch content and allow you to edit it before it is output.
3. Debugging is Important
Before you do any WordPress plugin development always be sure to enable debugging and leave it on during the entire development process. By default, debugging is turned off so that if there are errors, they are not readily apparent to the website visitor. Most website visitors wouldn’t understand what these messages mean, but they are crucial for understanding how much progress you’re making.
Image by Jeff Hester via Flickr
4. Create Global Paths
The WordPress core stores all like files together; CSS files belong to one folder, images another, and so on.
When you’re creating a WordPress plugin, be sure to do the same by creating global file paths. They will keep your file structure clean –throwing files all throughout doesn’t help anyone and it has the potential to make debugging difficult.
5. Store Plugin Version Information within the WP Database
WordPress is one of the leading website CMS platforms because the organisation which issues each version of it does so pretty regularly. In addition to adding new features on a regular basis, they also improve its security with each release.
As a result you too will likely need to upgrade your plugin from time to time. In order to make upgrades install without any problems, insert version information within the WordPress database so that you might read it later to choose specific upgrade options which your plugin should take.
Not doing so can make upgrades cumbersome, causing them to fail.