Tools I use for developing WordPress Plugins & you should use too

At WPManageNinja we build plugins for small businesses and one of our top priorities is to write a clean, maintainable codebase as well as make sure to keep the footprint very minimal.

Things we always keep in mind

  • No PHP error or notices
  • Keep the DB queries super minimal
  • Avoid Duplicate Queries
  • Avoid loading assets globally

Over the years, we found a few awesome developer-friendly plugins that help us build more efficiently. In this post, I will show you our internal setup for developing plugins.

Server

As 100% of our developers use MacOS so we prefer to use Laravel Valet. This is really a handy tool to manage the local sites, boot up Nginx, manage PHP versions, etc. It’s not necessary for every developing environment. You can choose other solutions like XAMPP, Laragon, Local By FlyWheel. As a database engine, some of our devs use MySQL and some use MariaDB.

wp-config.php configaration

In our plugin, we add integration natively with many other WP plugins often find lots of PHP notices, and it’s because WordPress by default doesn’t show the PHP notices, and developers don’t see those notices. So, please at least enable debug log when you develop in WordPress.

Here are my wp-config definitions when developing a Plugin.



define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', true );
define( 'CONCATENATE_SCRIPTS', false );

For further reading please check the official doc.

Must have plugins when developing

We found some pretty handy plugins that really help us when developing our plugins. I will list all of them and give a little intro about them.

1. Debug Toolkit

If you built something in Laravel, you know how excellent their built-in debugging and helper functions are. Debug Toolkit plugin will give you the exact same functionalities for you. Just install it and whenever it will get errors it will show the exact file and line number with back-trace information which will help you to resolve the issue quickly. Along with this, you can use some helper functions to explore your variables, classes, or objects.

Few useful functions:

  • vd($var) Dumps the given variable.
  • vdd($var) Dumps the given variable AND then ends the execution of the program.
  • dd($var) are Dumps the given variable with some nice UI
  • trace(): Dumps the backtrace at the point where this function is invoked.
  • trace_dump($var): Dumps the backtrace at the point where this function is invoked AND then dumps the given variable.
  • trace_dump_and_die($var) Dumps the backtrace at the point where this function is invoked * AND then dumps the given variable * AND then ends the execution of the program.

Install Debug Toolkit right now and debug like a PRO. [The developer doesn’t update the plugin frequently, but no worries, it works like a charm].

2. Query Monitor

Query Monitor is another awesome tool to monitor DB queries as well as it gives an overview of PHP errors, hooks, and actions, block editor blocks, enqueued scripts, and stylesheets, HTTP API calls, and more. If you build something which requires many SQL queries this is a must-have plugin. You can analyze which query needs to be improved. You can also find which plugin is making lots of DB queries and impacting your site performance.

3. CRON Jobs Debugging – WP Crontrol

This is not a must-have plugin but if you want to debug scheduled events on WordPress then you can defiantly use it. It’s super nice and developed by the same developer of Query Monitor.

4. User Switching

This is also not a must-have plugin but very useful when you need to test your plugin for different user levels or permission or even to test different UI elements for different users. With this plugin, you can switch between users with a single click. very handy!

Other Useful plugins

Code Editor / IDE

Personally, I use PHPStorm by JetBrains which is one of the best IDE for PHP. It helps me to easily find the unused code base, and variables, it can also give super useful hints which is super helpful. But it really depends on each developer. In our team, most of the devs use PHPStorm and a few use VS-Code / Sublime Text.

Let me know in the comment box what tools you use for developing high-performance plugins or building a site for your customers.

Latest comments (3)