You could use wp config get
to determine if debug is enabled or not, however today there is no way to set that value via WP-CLI.
That said, just wrote a bash command that can toggle the value for you.
You can run it in the same directory you have your wp-config.php
:
data=`egrep "'WP_DEBUG'" wp-config.php | egrep -o "(true|false)"`; [[ $data == true ]] && newdata=false || newdata=true; sed -i "s/'WP_DEBUG'.*/'WP_DEBUG', $newdata\)\;/g" wp-config.php
Every time you run it, the WP_DEBUG
constant value will switch from true
to false
or vice-versa.
Unfortunately there is no way to toggle the WP_DEBUG
value during the script execution, since the value was already defined in wp-config.php
file.
vi
but still not a great solution. hoping someone has the real answer. – Vinny