Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WP-CLI Toggle WP_DEBUG

I'm looking to toggle the WP_DEBUG value within a WP-CLI script. Is there any option doing so AFTER the wp-config.php file was created?

(I know we can add extra PHP when creating the wp-config.php file, but once that's done, is there a way to turn off the WP_DEBUG state during the script?)

Thanks.

like image 819
tlt2w Avatar asked Feb 29 '16 22:02

tlt2w


2 Answers

Woohoo! Native support added since WP-CLI version 1.5 -

https://developer.wordpress.org/cli/commands/config/set/

Example:

# Set the WP_DEBUG constant to true.
$ wp config set WP_DEBUG true --raw
like image 143
tlt2w Avatar answered Nov 15 '22 09:11

tlt2w


To extend on @tlt2w answer posted above, I'm using this combo:

wp config set --raw WP_DEBUG true
wp config set --raw WP_DEBUG_LOG true
wp config set --raw WP_DEBUG_DISPLAY false

# show logs:
# clear; tail -f wp-content/debug.log -n0
like image 24
Vladan Avatar answered Nov 15 '22 11:11

Vladan