Easy code troubleshooting in wordpress

The best way to troubleshoot/debug your PHP code for WordPress is to use the XDEBUG debugger for PHP coupled with an IDE/editor that can leverage XDEBUG.

By far my favorite IDE for PHP/XDEBUG is PhpStorm (best money I have ever spent), but you can use for free on the bleeding edge with their EAP (Early Access Program). You can also use the free VSCode with XDEBUG.

Here is a great video showing what it looks like to use XDEBUG & PhpStorm. You can start at the 18:00 point because everything before that is talking and slides.

You will also need a local development setup that supports XDEBUG. Several years ago I was frustrated with how difficult it was to get XDEBUG configured correctly so I had my team develop WPLib Box which pre-configures XDEBUG and thus makes using XDEBUG trivally easy. You can download WPLib Box from GitHub, use for free, and get help via our Slack.

I like to say using PhpStorm/XDEBUG/WPlib Box gives me WordPress superpowers. How else do you think I answered all the questions here at WPSE that I have? 🙂

That said, there are also other local development solutions such as VVV, Trellis, Chassis, Desktop Server, MAMP, DevilBox, LaraDock, Kalabox, Kusanagi and others you might try. But I am not sure how difficult it is to set up XDEBUG to work with any of these others anymore but I know firsthand XDEBUG works without any fuss when using WPLib Box.

Hope this helps.

Leave a Comment