Set WordPress to Enable Error Logging but Move Error Log Outside of /public_html/

The snippet below is for pasting into wp-config.php:

  • to enable error logging into file debug.log, but move it outside of public_html
  • to disable showing errors (you can switch comment below to allow display of errors)

 

// Enable WP_DEBUG mode
define( 'WP_DEBUG', true );

// Enable Debug logging to the debug.log file
//define( 'WP_DEBUG_LOG', true );
ini_set( 'log_errors', 1 );
ini_set( 'error_log',  __DIR__. '/../debug.log' );

// Disable display of errors and warnings 
//define( 'WP_DEBUG_DISPLAY', true );
//@ini_set( 'display_errors', E_ALL );
define( 'WP_DEBUG_DISPLAY', false );

// Use dev versions of core JS and CSS files (only needed if you are modifying these core files)
define( 'SCRIPT_DEBUG', true );

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>