This week, I’m going to walk you through what it takes to start checking your plugin’s PHP compatibility. Every time I start a new plugin, one of the first things I do is configure a composer script that checks PHP compatibility for me. If you are writing a WordPress plugin, you should be checking it’s […]
Articles
3 Lessons I’ve Learned Building Enterprise WordPress Plugins
Over the last few years, I’ve built quite a few plugins—most of them never installed on more than one site. When a client wants a bit of custom functionality, there’s no better tool in your tool-belt than a custom plugin. If you need the same functionality on a couple of sites (for the same client […]
WordPress Nonce 101: What are they and why do they matter?
If your plugin has its own settings page and performs any kind of CRUD (Create, Read, Update, Delete) action, then you should be using nonces. If you’ve never heard of the term nonce before, WordPress defines it in the codex as, “number used once”. Once a nonce is used, it cannot be used again—a one-time […]
SWPD #014: Does Your Plugin Need a Custom Database Table?
WordPress has grown to be a huge portion of the internet and therefore has been proven to scale really well in the right conditions. At its core, it’s just a PHP application interfacing with a MySQL database, but sometimes you need additional functionality with the database. Every time I find myself storing lots of records […]
SWPD #013: How to Make Breaking Changes In your Plugin
If you’ve created a plugin in the WordPress repository, you’ve likely been at a point where you need to modify or remove a publicly accessible function. By publicly accessible I mean: Any function or hook that could be used by other developers modifying your plugin’s functionality. If developers rely on these functions, how do you […]
SWPD #012: Semantic Versioning 101
If you have a plugin in the WordPress repository, the plugin team requires that you have a version number. However, I see a lot of plugins declaring arbitrary version numbers for their releases. As an example, Jetpack, one of Automattic’s commercial plugins is currently on version 12.3 with the version 12.4 approaching. While this is […]
SWPD #011: The Four Levels of Automated Testing
This week, I’m going to walk you through the four levels of automated testing. Each level of testing covers a different aspect of the overall quality of your plugin code. It provides confidence that the code does what you expect it to do, in all cases. Unfortunately, lots of developers aren’t aware of each level […]
SWPD #010: How to Add Acceptance Tests to Your WordPress Plugin
This week, I’m going to walk through a testing setup that you can implement in about 20 minutes and a test that will cover the entirety of your plugin right off the bat. But first, I want to talk about why testing is such an issue for WordPress developers. It often starts out with this […]
SWPD #009: How to Audit the Codebase of Your WordPress Plugin
This week I’m going to show you how to do an audit for the codebase of a WordPress plugin. A checklist of areas where you can steadily make improvements helps you make the best decision of where you should spend your time. You should always be auditing your plugin for areas of improvement, but often […]
SWPD #008: Namespacing WordPress Hooks in Plugins
This week, I’m going to show you one of the best ways I’ve found to write quality hook names for your plugin’s actions & filters. I’ve been working on a few plugins recently where I needed to implement some hooks so users could override values in an API request. First, a little context: I didn’t […]