How to turn on WordPress debugging safely
Use WP_DEBUG, WP_DEBUG_LOG and WP_DEBUG_DISPLAY to see WordPress errors without showing them to visitors, and turn debugging off afterwards.
On this page
WordPress can log every PHP error, warning and notice to a file. It’s the quickest way to diagnose plugin and theme problems.
Turn on logging (not display)
In wp-config.php, find define('WP_DEBUG', false); and replace it with:
define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
define('WP_DEBUG_DISPLAY', false);
@ini_set('display_errors', 0);Errors are now written to wp-content/debug.log and not shown to visitors.
Read the log
- Reproduce the problem.
- Open
wp-content/debug.login System Info & Files › File Manager. - Read from the bottom up. Fatal errors matter most; deprecation notices are usually harmless.
Turn it off afterwards
Set WP_DEBUG back to false, and delete debug.log. Left on, the log grows endlessly and can reveal file paths and details to anyone who finds it.
Keep the log private
If you’ll leave logging on for a while, move the log outside the web root:
define('WP_DEBUG_LOG', '/home/USERNAME/wp-debug.log');Replace USERNAME with your DirectAdmin username.
Prefer to follow along?
- Fix a WordPress critical error without admin access
Intermediate · 20 min
Everything in this guide works on Traxio’s WordPress hosting: £0.99 a month.
If it doesn’t work
These guides cover the most common problems, starting with what you can see. Or browse every fix for a common problem.
- Blank white page: how to find the hidden errorA completely blank page usually means a PHP error that isn’t displayed. How to reveal it with logs and fix the cause.
- “Too many redirects” and HTTPS redirect loopsFix ERR_TOO_MANY_REDIRECTS: conflicting HTTPS and www rules in .htaccess, WordPress settings, plugins and Cloudflare’s SSL mode.
- How to log in to WordPress adminWhere the WordPress login page is, what to do if you’ve forgotten the password or the password reset email never arrives.
Spotted something out of date or unclear? Tell us and we’ll fix it.