Why do WordPress plugin developers need debug-oriented plugins?

WordPress comprises a dynamic open-source environment where plugins and custom backends interact with a plethora of elements: themes, core updates, other plugins, and diverse server configurations. Debugging your plugins and backends can be complex and time-consuming without specialized debugging tools. This process can discourage independent developers from maintaining their products and even slow down companies that are building and maintaining largely used plugins, in the absence of appropriate tools and practices.

At WP Media, we are constantly refining and enhancing our approach to testing and debugging to streamline it and make it accessible to the entire Engineering team, so that everyone can actively and easily contribute to our quality processes. This article is therefore based on this experience and lists a few tools we are leveraging every day to build products like WP Rocket and Imagify!

Despite the intimidating nature of WordPress’s expansiveness, it’s precisely this openness that fuels its strength. The WordPress community has encountered and overcome these challenges, resulting in the development of numerous plugins designed specifically to assist in investigating and debugging backend issues. They are well-integrated into WordPress admin, making it easy for anyone to access and use them, regardless of the environment in which the website is running: you don’t always have access to more conventional tools like Adminer, phpMyAdmin, or CLI of the database.

5 free plugins for WordPress plugin developers

Without further ado, here are five plugins I install on all websites I work on: from testing and staging environments at WP Media to this very website!

Note: For production websites, it is usually good practice to avoid useless plugins. While I never encountered issues or front-end slow-downs linked to the following plugins, you can consider deactivating them when your debug session is over.

WP Data Access

Most backend features and plugins leverage a database: WordPress core itself heavily uses the database and most plugins as well, whereas they define custom tables or use already existing WordPress tables with custom post types or the WP Database APIs. Simple, clear, and quick access to those tables is critical to validate some behaviors and investigate issues.

WP Data Access is a great tool to navigate the database from the WP admin. The free plan is loaded with a lot of features already and completely covers all my use cases. The simple GUI will allow everyone to easily browse and explore the database with simple yet effective search features, while more advanced users can execute their own SQL queries directly.

WP Data Access allows you to execute SQL queries directly from WP admin, for free!

Transients Manager

Transients are quite similar to options in WordPress, except for the added expiration time for each transient. This specificity makes it more convenient to use a dedicated plugin to browse transients rather than explore the wp_options table.

Transients Manager is a simple plugin that adds a Transients sub-menu within the Tools menu of your WP admin. This added page lists all transients and their expiration date and offers features such as search and edit. This quick access to transients has proven very efficient when testing specific behaviors or trying to observe the website’s current state.

WP Crontrol

WordPress CRON jobs is a heavily used feature of WordPress for asynchronous features. Like transients, CRON jobs are stored in the wp_options table, but having a dedicated plugin helps to capture their specificities such as recurrence, targeted action, and arguments.

WP Crontrol provides just that: a new Cron Event sub-menu with the Tools menu of your WP admin. This new page displays all planned CRON events with additional details such as their frequency, next run time, and which action they will trigger. You can also directly search, edit, suspend, or immediately trigger a CRON from this page. Those simple features greatly speed up the testing and debugging of CRON-based features. Additionally, the plugin provides a page to list and edit defined CRON frequencies to ease the customization of asynchronous schedules of some plugins for example!

Code Snippets

I frequently find myself thinking “I could quickly check this with just a few lines of code!” when experimenting with a possible new feature, testing, debugging or even just playing around. And not only with WordPress! Too often, preparing a setup to run those few lines takes much more time than actually playing with them, and this can lead you to lose focus on what truly matters.

Code Snippets commoditizes inserting lines of code and executing them on your WordPress website! You don’t need to manually update functions.php or create small custom plugins only to execute some lines of code: Code Snippets provides a GUI to write blocks of code, and dynamically enable them to be executed within your WordPress site. This is particularly useful to experiment with hooks or change some behaviors quickly. Note that you can easily export/import snippets to share them with your team or across your different websites!

Code Snippets is a great way to register callbacks to actions and filters to quickly and easily customize WordPress and plugin behaviors.

Query Monitor

Query Monitor is one of the most widely known debugging plugins on WordPress: don’t get fooled by its name; it does much more than monitor SQL queries! From describing HTTP and AJAX requests to listing executed hooks and enqueued scripts, this feature-loaded plugin provides tons of information about what is executed when loading a page, and the environment.

However, this plugin can be overwhelming for non-tech-savvy users and it can be hard to navigate and read when you don’t know exactly what you are looking for. I personally don’t go for it as a first step of investigations but rather use it to get technical data once I know what aspects I need to dig into.

Additional plugins to know about

While writing this article, I thought about mentioning a few other plugins. But they did not make the cut to the Top 5 as I don’t systematically install them but only use them in some specific situations. I still think they are great plugins that can prove useful and that WordPress developers should now; so I share them with you in the following.

WP Debugging

WP Debugging allows you to adjust WP debugging constants directly from WP admin rather than manually updating wp-config.php. While this can prove useful if you are not comfortable handling this file, or if you are working on a website without access to it, I favor manually editing and organizing wp-config.php. Also, advanced plugins like WP Rocket often have their own logging system, with dedicated constants and log files for which manually handling the constant definition is needed.

The plugin also offers access to the WP log file, directly from WP Admin. Once again, this can prove very useful if you can’t access the server with SSH or FTP for instance. Personally, I find it more efficient to connect to the server through SSH and use the tail -f command on the log file to get new logged lines in real time in the terminal.

Debug Bar

Debug Bar is a renowned plugin in the WP development community even mentioned in the official WP developer documentation. While this plugin offers a few debugging features such as monitoring queries, I find that those features are better covered by the aforementioned plugins. The strength of this plugin is that it adds a debug menu to the WP admin bar as well as an easy way for developers to add their own custom page in the menu, through add-ons (other WP plugins that rely on Debug Bar).

Many small add-ons exist for very specific debugging and monitoring. While you probably don’t need them in your go-to environment, looking through them when you face a specific issue can be a good idea.

A few months ago, while my team was investigating high CPU usage on our plugin WP Rocket, we used Debug Bar combined with Debug Bar Slow Action to easily identify which part of the code took too much time to run. Without having to write custom code for this investigation, we were able to spot which callback was creating the issue and we were able to optimize it. As a follow-up, we forked and customized the Slow Action add-on to provide further insights on WP Rocket callbacks and integrate it into our QA processes. This has been a great example of how everyone can efficiently leverage the WP community and open-source products to enhance their processes and product quality.

Action Scheduler

Action Scheduler is the most used job queueing system for WordPress. It is used in many WP plugins and it is a dependency we heavily use as well at WP Media in our products. You probably won’t need to install this plugin yourself, ever: plugins using the Action Scheduler system usually include it directly as a dependency.

Why is Action Scheduler in this article about debug plugins then? Mostly because it has great built-in observability by adding a page in the WP Admin Tools menu (Scheduled actions). This page lists all actions that are or have been scheduled, as well as some additional information about the schedule and the status of the action. Knowing about this is critical when investigating issues linked to asynchronous mechanisms so that you can observe the queue, the jobs, and their logs.

Duplicator

Duplicator is a very complete plugin with backup and migration capabilities. I started using it at WP Media as a tool to clone staging and test websites and duplicate them easily. Duplicator makes this operation very simple and quick, allowing every developer to have their own test website being a replica of a main test website maintained and updated by our QA team.

Therefore, we use Duplicator in a very specific context and only for a few of its features. But it became a key component of our quality processes and environment management tools.

Set up your debug environment today to speed up your WordPress development forever!

I strongly encourage every WordPress developer to take some time to play a bit with the plugins mentioned in this article: you can get them for free and mastering them will greatly speed up your debugging process by leveraging the experience of the WordPress community!

Observability and getting to know better your own products are key to engineering success and this list provides a great place to start. And you can always go further! As you perfect your ways to debug and increase quality, you will face new challenges and identify new needs: the WordPress community and open-source in general have many resources that you will be able to leverage and you should even consider contributing yourself, by sharing your own tools and advanced customizations.

Leave a Reply

Your email address will not be published. Required fields are marked *