Search code examples
wordpresscommand-line-interfacewp-cli

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.


Solution

  • 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