Skip to content

Instantly share code, notes, and snippets.

@dhirenpatel22
Created March 16, 2026 18:13
Show Gist options
  • Select an option

  • Save dhirenpatel22/a7ce04a8e7de5f5de38455d3c8c4b25e to your computer and use it in GitHub Desktop.

Select an option

Save dhirenpatel22/a7ce04a8e7de5f5de38455d3c8c4b25e to your computer and use it in GitHub Desktop.
WordPress Smart Debug
<?php
/**
* WordPress Debug Configuration
*
* This file handles WordPress debug settings based on the 'debug' GET parameter.
* It sets up WP_DEBUG constants and error display settings.
*
* @package WordPress
* @subpackage Configuration
*/
// Check if debug parameter is set to 'true' in the URL
if ( isset( $_GET['debug'] ) && $_GET['debug'] === 'true' ) {
// Enable WordPress debug mode with errors displayed
// This is useful for development and troubleshooting
define( 'WP_DEBUG', true );
} else {
// Enable WordPress debug mode but hide errors from display
// Errors will be logged to wp-content/debug.log instead
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_DISPLAY', false );
// Suppress PHP error display in the browser
@ini_set( 'display_errors', 0 );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment