I’ve been using Herd Pro for local development recently, and it works great. One really cool feature is the automatic Xdebug detection, which turns on Xdebug automatically if required (either through a detected breakpoint in PHPStorm or using a browser extension).
I often work with custom WP-CLI commands and sometimes want to enable Xdebug when running these commands. To do so, you can run the following command:
Terminalherd debug $(which wp)
herd debug ..
is a replacement for php ..
but with Xdebug enabled, and $(which wp)
points to the path of the WP-CLI executable.
If you want to run wp post list
but with Xdebug enabled, you can run herd debug $(which wp) post list
instead.
This gets tedious quickly, so I also recommend adding this to your ~/.bashrc
or ~/.zshrc
file:
Terminalalias wpx='herd debug $(which wp)'
Now, you can use wp
to run WP-CLI without Xdebug, and wpx
to run WP-CLI with Xdebug enabled.
Leave a Reply