Skip to content

Instantly share code, notes, and snippets.

@carl-alberto
Created February 6, 2021 05:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save carl-alberto/69ea85616f1f6510f06633ad9f491e96 to your computer and use it in GitHub Desktop.
Save carl-alberto/69ea85616f1f6510f06633ad9f491e96 to your computer and use it in GitHub Desktop.
Enabling extensive debugging in dev & multidev env in Pantheon
if (defined('PANTHEON_ENVIRONMENT')) {
// Turns on WordPress debug settings in development and multidev environments, and disables in test and live.
if (!in_array(PANTHEON_ENVIRONMENT, array('test', 'live'))) {
// Debugging enabled.
if (!defined('WP_DEBUG')) {
ini_set( 'log_errors','On' );
ini_set( 'display_errors','On' );
ini_set( 'error_reporting', E_ALL );
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DISABLE_FATAL_ERROR_HANDLER', true );
define( 'WP_DEBUG_DISPLAY', true );
}
if (!defined('WP_DISABLE_FATAL_ERROR_HANDLER')) {
define( 'WP_DISABLE_FATAL_ERROR_HANDLER', true ); // 5.2 and later
}
if (!defined('WP_DEBUG_DISPLAY')) {
define( 'WP_DEBUG_DISPLAY', true ); // requires WP_DISABLE_FATAL_ERROR_HANDLER set to true
}
define( 'WP_DEBUG_LOG', __DIR__ . '/wp-content/uploads/debug.log' ); // Moves the log file to a location writable while in git mode. Only works in WP 5.1
}
// WordPress debug settings in Test and Live environments.
else {
// Debugging disabled.
ini_set( 'log_errors','Off');
ini_set( 'display_errors','Off');
ini_set( 'error_reporting', E_ALL );
define( 'WP_DEBUG', false);
define( 'WP_DEBUG_LOG', false);
define( 'WP_DISABLE_FATAL_ERROR_HANDLER', false );
define( 'WP_DEBUG_DISPLAY', false);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment