๐ŸŸข Network Status| First month from $2.00 โ€” fully managed | Contact Support
Skip to content
Need help? Real engineers available 24/7. Average response under 15 minutes. Open a support ticket โ†’

Enable Debug Mode in WordPress โ€‹

WordPress debug mode reveals PHP errors, notices, and warnings that are hidden in production. It's essential for diagnosing issues with plugins, themes, or custom code.

โš 
Never leave debug mode on in production
Debug mode displays error messages that may reveal file paths, database names, or code details to visitors. Enable it only when actively debugging, and disable it when finished.

Enabling debug mode โ€‹

Edit wp-config.php in your WordPress root directory. Find the line that says define( 'WP_DEBUG', false ); and replace the debug section with:

php
// Enable debug mode โ€” show all errors
define( 'WP_DEBUG', true );

// Log errors to a file instead of displaying on screen
define( 'WP_DEBUG_LOG', true );

// Hide errors from visitors (write to log only)
define( 'WP_DEBUG_DISPLAY', false );

// Suppress deprecated notices (optional โ€” reduces noise)
define( 'SCRIPT_DEBUG', true );

With WP_DEBUG_DISPLAY set to false, errors are written to /wp-content/debug.log and not shown to visitors.

Viewing the debug log โ€‹

bash
# SSH into your server and tail the log
tail -f /home/cpanelusername/public_html/wp-content/debug.log

# Or view the last 100 lines
tail -n 100 /home/cpanelusername/public_html/wp-content/debug.log

Or download it via cPanel โ†’ File Manager โ†’ navigate to public_html/wp-content/debug.log.

Enabling error display (for local/dev only) โ€‹

On a local development environment where exposing errors to the screen is acceptable:

php
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_DISPLAY', true );  // Show errors on screen
define( 'WP_DEBUG_LOG', false );
@ini_set( 'display_errors', 1 );
โš 
Do not use WP_DEBUG_DISPLAY on a live server
Setting WP_DEBUG_DISPLAY to true on a production server shows error details to all visitors โ€” including database names, file paths, and code excerpts. Use WP_DEBUG_LOG instead.

Common errors and what they mean โ€‹

ErrorLikely cause
Call to undefined functionA plugin or theme function is missing โ€” plugin may not be active or is outdated
Fatal error: Cannot redeclareTwo plugins or theme files defining the same function
PHP Warning: include_onceA file is missing โ€” deleted plugin files or incomplete upload
WordPress database errorMySQL connection issue or a query error โ€” check DB credentials in wp-config.php
Maximum execution time exceededA process took too long โ€” increase max_execution_time in PHP settings or optimize the slow query

Disabling debug mode โ€‹

When you're done, set WP_DEBUG back to false:

php
define( 'WP_DEBUG', false );

Or remove the debug lines entirely โ€” the default WordPress wp-config.php has WP_DEBUG set to false.

Query Monitor plugin โ€‹

For more detailed debugging without editing wp-config.php, install the Query Monitor plugin. It shows database queries, PHP errors, hooks and actions, HTTP API calls, and page load performance โ€” all in a browser toolbar panel visible only to logged-in admins.

Managed hosting that actually manages.