Skip to content

Instantly share code, notes, and snippets.

@Pebblo
Last active September 1, 2017 09:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Pebblo/8787f5530ea777c84aaf62f075e55b32 to your computer and use it in GitHub Desktop.
Save Pebblo/8787f5530ea777c84aaf62f075e55b32 to your computer and use it in GitHub Desktop.
Snippet to enable WP_DEBUG but log the errors rather than display them on the page.
<?php //Do not include the opening PHP tag
//This code enabled WP Debug but disables display_errors so they are not shown on the page.
//Any errors thrown on your site will be stored within a debug.log file within /wp-content/
define('WP_DEBUG', true);
if ( WP_DEBUG ) {
@error_reporting( E_ALL );
@ini_set( 'log_errors', true );
@ini_set( 'log_errors_max_len', '0' );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false);
//define( 'CONCATENATE_SCRIPTS', false );
//define( 'SAVEQUERIES', true );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment