Intermediate Standard

How to enable WP_DEBUG in WordPress

By Angus Published 14 May 2026 5 min read

When your WordPress site shows a blank white screen or behaves unexpectedly, PHP errors are often the cause. WordPress includes a built-in debugging system that you can activate by editing a single configuration file, giving you visibility of the errors your site is generating.

By the end of this guide, you will have WP_DEBUG configured in your wp-config.php file and be able to view or log PHP errors to diagnose what is going wrong.

Before you begin

  • You need access to your site’s files via cPanel File Manager or an FTP client.
  • Locate your wp-config.php file in the root directory of your WordPress installation, typically public_html/.
  • We recommend taking a backup of your site before editing core configuration files.
  • Never leave WP_DEBUG set to true on a live site once you have finished diagnosing the problem.

Enable WP_DEBUG in wp-config.php

WordPress reads its debug configuration from constants defined in wp-config.php. Setting WP_DEBUG to true tells WordPress to report all PHP errors and notices, including those triggered by plugins and themes. By default this constant is set to false, so errors are suppressed.

  1. Open your wp-config.php file.
    Log in to cPanel File Manager and navigate to your WordPress root directory. Right-click wp-config.php and select Edit.
  2. Find the WP_DEBUG constant.
    Search the file for the line that reads define( 'WP_DEBUG', false );. This line is present in all standard WordPress installations.
  3. Set WP_DEBUG to true.
    Change false to true so the line reads as follows:
define( 'WP_DEBUG', true );
  1. Save the file.
    Click Save Changes in File Manager. PHP errors will now appear on screen when you visit your site.
  2. Reproduce the problem.
    Visit the page or perform the action that was causing the issue. Any PHP errors will be displayed directly in the browser, showing you the file, line number and error message.
  3. Disable WP_DEBUG when finished.
    Once you have identified the error, set WP_DEBUG back to false and save the file. Leaving debug mode active on a live site exposes internal file paths and error details to visitors.
cPanel File Manager editor showing the WP_DEBUG constant in wp-config.php
Edit wp-config.php directly in cPanel File Manager.

Log errors to a file instead of displaying them

Displaying errors on screen is useful during local development, but on a live site you may prefer to write errors to a log file so they are not visible to visitors. The three constants below work together: WP_DEBUG activates error reporting, WP_DEBUG_LOG writes errors to a file, and WP_DEBUG_DISPLAY controls whether they appear on screen.

Add or update the following lines in wp-config.php, above the line that reads /* That's all, stop editing! Happy publishing. */:

define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );

With this configuration, WordPress writes all PHP errors to wp-content/debug.log without displaying them to visitors. You can review this file at any time using File Manager or an FTP client. If you want errors written to a different location, set WP_DEBUG_LOG to the full file path instead of true, for example define( 'WP_DEBUG_LOG', '/home/username/logs/wp-errors.log' );.

cPanel File Manager displaying debug.log inside the wp-content folder
The debug.log file is created inside wp-content when WP_DEBUG_LOG is enabled.

Troubleshooting

No errors appear after enabling WP_DEBUG

If you set WP_DEBUG to true but no errors appear on screen, WP_DEBUG_DISPLAY may already be defined elsewhere in wp-config.php and set to false. WordPress also suppresses error display automatically for REST API, Ajax and XML-RPC requests, so errors from those request types will not appear in the browser regardless of your settings.

  • Search wp-config.php for any existing WP_DEBUG_DISPLAY definition and remove or update it.
  • Enable WP_DEBUG_LOG and check wp-content/debug.log for errors that are being suppressed from the screen.
  • Confirm you saved the file after making changes and that you are viewing the correct domain.

The debug.log file is not being created

If WP_DEBUG_LOG is set to true but no debug.log file appears in wp-content/, the web server process may not have write permission to that directory.

  • Check the permissions on your wp-content/ directory. It should be set to 755.
  • Confirm that WP_DEBUG is also set to true. WP_DEBUG_LOG has no effect unless WP_DEBUG is active.
  • Try setting WP_DEBUG_LOG to an absolute file path in a directory you know is writable.

Wrapping up

You have configured WordPress debug mode by editing wp-config.php. You can now display PHP errors on screen during diagnosis or write them silently to wp-content/debug.log while keeping your site looking normal to visitors.

Once you have resolved the underlying error, remember to set WP_DEBUG back to false. For related tasks, see our guides on removing malware from WordPress, increasing the WordPress memory limit and fixing common website error codes.

If you are running WordPress on managed hosting, our WordPress hosting plans include tools to help you monitor and maintain your site.

Running a WordPress site?

Get fast, secure and reliable WordPress Hosting with optimised for performance with AccelerateWP.

Get WordPress Hosting

Need multiple accounts?

Create fully isolated individual accounts for your clients and manage them all from one dashboard.

Get Reseller Hosting