Skip to content

Instantly share code, notes, and snippets.

@joshlevinson
Last active April 21, 2023 12:04
Show Gist options
  • Select an option

  • Save joshlevinson/93253aec2b41749e10de to your computer and use it in GitHub Desktop.

Select an option

Save joshlevinson/93253aec2b41749e10de to your computer and use it in GitHub Desktop.
WP CLI + Xdebug
# Add this to /config/bash_profile
function wpd {
export XDEBUG_CONFIG="idekey=VVVDEBUG remote_connect_back=1"
wp "$@"
unset XDEBUG_CONFIG
};
# Run these commands:
# vagrant ssh
# sudo cp /srv/config/bash_profile /home/vagrant/.bash_profile
# source ~/.bash_profile
# Use wpd instead of wp when you want to debug wp-cli commands
@iandunn
Copy link
Copy Markdown

iandunn commented Jun 10, 2020

That worked for me, thanks!

If anyone's looking for profiling rather than debugging, this looks like it'd work:

https://daryl.blog/2013/08/14/using-xdebug-with-wp-cli/

@rmpel
Copy link
Copy Markdown

rmpel commented Apr 21, 2023

EXCELLENT! Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment