WordPress Config Tweaks: Better Debugging

// MAXIMUM DEBUGGING POSSIBLE 
// DISPLAYS AND LOGS ALL ERRORS
define( 'WP_DEBUG', true ); 
// UNCOMMENT THE BELOW LINE TO DISABLE DEBUGGING
// WITHOUT CHANGING ANYTHING ELSE, YOU CAN LEAVE THE ABOVE DEBUG LINE AS IS
// define( 'WP_DEBUG', false ); 

if ( WP_DEBUG ) {
    // Edit the following line to set your debug log location.
    define( 'WP_DEBUG_LOG', '/home/website.com/logs/debug.log' );
    define( 'WP_DEBUG_DISPLAY', true );
    define( 'SCRIPT_DEBUG', true );
    @ini_set( 'display_errors', 1 );
    @ini_set( 'display_errors', 'On' );
    @ini_set( 'log_errors', 'On' );
    // Edit the following line to set your php error log location.
    @ini_set( 'error_log', '/home/website.com/logs/php_error.log' );

}

Edit your wp-config.php and use this instead of the stock debug code. #

 
/** MAXIMUM DEBUGGING POSSIBLE **/ 
// DISPLAYS AND LOGS ALL ERRORS
define( 'WP_DEBUG', true ); 
// UNCOMMENT THE BELOW LINE TO DISABLE DEBUGGING WITHOUT CHANGING ANYTHING ELSE, THE LOWER LINE WILL OVERRIDE THE DEBUG TRUE FROM EARLIER
// define( 'WP_DEBUG', false ); 
if ( WP_DEBUG ) {
    define( 'WP_DEBUG_LOG', true );  // Set to true, default is wp-content/debug.log
    define( 'WP_DEBUG_LOG', '/home/website.com/logs/debug.log' );
    define( 'WP_DEBUG_DISPLAY', true );
    define( 'SCRIPT_DEBUG', true );
    @ini_set( 'display_errors', 1 );
    @ini_set( 'display_errors', 'On' );
    @ini_set( 'log_errors', 'On' );
    @ini_set( 'error_log', '/home/website.com/logs/php_error.log' );
}

Code highlighted via https://pinetools.com/syntax-highlighter Qtcreator Dark Theme #

/** MAXIMUM DEBUGGING POSSIBLE **/ 
// DISPLAYS AND LOGS ALL ERRORS
define( 'WP_DEBUG', true ); 
// UNCOMMENT THE BELOW LINE TO DISABLE DEBUGGING WITHOUT CHANGING ANYTHING ELSE
// define( 'WP_DEBUG', false ); 
if ( WP_DEBUG ) {
    define( 'WP_DEBUG_LOG', true );  // Set to true, default is wp-content/debug.log
    define( 'WP_DEBUG_LOG', '/home/website.com/logs/debug.log' );
    define( 'WP_DEBUG_DISPLAY', true );
    define( 'SCRIPT_DEBUG', true );
    @ini_set( 'display_errors', 1 );
    @ini_set( 'display_errors', 'On' );
    @ini_set( 'log_errors', 'On' );
    @ini_set( 'error_log', '/home/website.com/logs/php_error.log' );
}

Code highlighted via https://tohtml.com/php/ Black Style #

<?php
/** MAXIMUM DEBUGGING POSSIBLE **/ 
// DISPLAYS AND LOGS ALL ERRORS
define( 'WP_DEBUG', true ); 
// UNCOMMENT THE BELOW LINE TO DISABLE DEBUGGING WITHOUT CHANGING ANYTHING ELSE
// define( 'WP_DEBUG', false ); 
if ( WP_DEBUG ) {
    define( 'WP_DEBUG_LOG', true );  // Set to true, default is wp-content/debug.log
    define( 'WP_DEBUG_LOG', '/home/website.com/logs/debug.log' );
    define( 'WP_DEBUG_DISPLAY', true );
    define( 'SCRIPT_DEBUG', true );
    @ini_set( 'display_errors', 1 );
    @ini_set( 'display_errors', 'On' );
    @ini_set( 'log_errors', 'On' );
    @ini_set( 'error_log', '/home/website.com/logs/php_error.log' );

}
?>

Powered by BetterDocs

Leave a Reply

Your email address will not be published. Required fields are marked *

*