[Special Summer Sale] 40% OFF All Magento 2 Themes

Cart

Debugging with WordPress WP_DEBUG Log

  • This topic is empty.
Viewing 1 post (of 1 total)
  • Author
    Posts
  • #8883
    David Hoang
    Keymaster

    a) First edit your wp-config.php file adding the following lines to enable debug (if these are already defined, edit the values):

    define( 'WP_DEBUG', true );
    define( 'WP_DEBUG_LOG', true );
    define( 'WP_DEBUG_DISPLAY', false );

    As errors are logged, they should appear in wp-content/debug.log. You can open this file in a text editor.

    b) On your code: Use the following (where $variable is the variable to be displayed in the error log:

    error_log( print_r( $variable, true ) );

    Now you will get the data for debugging.

Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.