Enabling WordPress debug mode to diagnose errors
WordPress debug mode logs PHP errors, warnings, and notices that are hidden by default. Enable it safely to diagnose white screens, plugin conflicts,
On this page
WordPress suppresses all PHP errors by default to prevent sensitive information from showing to site visitors. Debug mode re-enables error logging to a file so you can see what's going wrong without exposing errors to the public.
What debug mode does
With WP_DEBUG enabled, WordPress:
- Logs PHP errors, warnings, and notices to
wp-content/debug.log - Helps identify which plugin or theme is throwing errors
- Shows deprecation notices from outdated code
- Reveals undefined variables and missing functions
Debug mode should write errors to a log file, not display them to visitors. The configuration below uses WP_DEBUG_DISPLAY = false to keep errors hidden from the public. Never set WP_DEBUG_DISPLAY to true on a production site-it exposes server paths, usernames, and code structure to visitors.
Enable debug mode
- Log in to cPanel → File Manager
- Navigate to your WordPress installation root (usually
public_html) - Open
wp-config.phpand find the line:define( 'WP_DEBUG', false ); - Replace that section with:
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );
@ini_set( 'display_errors', 0 );
Save the file. WordPress now writes errors to wp-content/debug.log instead of showing them to visitors.
Read the debug log
- In File Manager, navigate to
public_html/wp-content/ - Open
debug.log - Look for lines with
PHP Fatal error,PHP Warning, orPHP Notice - Each error shows the file path and line number where the problem occurred
A typical error:
[06-Jun-2026 14:55:32 UTC] PHP Fatal error: Uncaught Error: Call to undefined function
woocommerce_cart() in /home/user/public_html/wp-content/themes/mytheme/functions.php:87
This tells you the theme's functions.php at line 87 is calling a WooCommerce function that doesn't exist-WooCommerce may be deactivated or not installed.
Disable debug mode when done
After diagnosing your issue, set WP_DEBUG back to false:
define( 'WP_DEBUG', false );
Leaving debug mode enabled indefinitely fills up disk space as the debug.log file grows and may expose paths when errors occur in certain edge cases.
Query Monitor plugin
For diagnosing performance issues, slow database queries, or plugin conflicts in the browser, install the free Query Monitor plugin. It adds a debug bar to the WordPress admin showing queries, hooks, HTTP requests, and PHP errors in real time-without touching wp-config.php. Deactivate it when not needed.
Need managed WordPress hosting?
Run WordPress on UnderHost managed hosting with performance tuning, SSL, backups, security guidance, and expert support.





















