Web Analytics

How to Enable Debug Mode in WordPress

*We've picked products we think you'll love and may earn commission from links on this page.

WordPress comes with a built-in debug mode that helps developers and administrators detect problems in themes, plugins, or the core system. By enabling it, you can see detailed error messages and warnings that are usually hidden. This makes troubleshooting much easier and ensures you can find the root cause of issues quickly.

Activating debug mode requires editing one file in your WordPress installation. It is simple but should be done carefully to avoid breaking the site. Below you will find step-by-step instructions on how to do it properly.

Once activated, you will be able to log errors, hide them from visitors, and control how WordPress handles debugging information. This is especially important on production websites where you want errors recorded but not shown publicly.


Locating the wp-config.php File

The first step in enabling debug mode is to locate the wp-config.php file. This file is located in the root folder of your WordPress installation, the same place where you can find wp-content, wp-includes, and wp-admin. To access it, you can use FTP software, your hosting control panel’s file manager, or local file access if you are working on a development server.

It is recommended to make a backup of this file before making any changes. A single missing character can break your site, so having a backup ensures you can restore it immediately. Once you have found the file, open it in a text editor and prepare to adjust its configuration.

Activating WP_DEBUG

Inside the wp-config.php file, scroll until you find a line that looks like this: define( 'WP_DEBUG', false );. This line controls whether debug mode is active or not. By default, WordPress disables debugging for security and performance reasons. To activate debug mode, you simply need to change the value from false to true.

The correct line should look like this: define( 'WP_DEBUG', true );. After saving the file, WordPress will immediately begin displaying PHP warnings, notices, and error messages across your website. This allows you to identify problematic plugins, themes, or custom code.

Using WP_DEBUG_LOG for Error Logging

While displaying errors on the screen can be useful in development, it is not always practical. For long-term monitoring, you can activate WP_DEBUG_LOG. To do this, add the following line just below your WP_DEBUG constant: define( 'WP_DEBUG_LOG', true );. This will store all errors in a debug.log file inside the wp-content directory.

Having a log file is especially helpful when you need to track errors that occur at specific times, or when you cannot reproduce them directly on the screen. It also allows you to share the file with developers or support teams without giving them direct access to your site.

Hiding Errors from Visitors

If your WordPress site is live, you probably don’t want visitors to see raw error messages. In that case, you can add another setting to disable front-end error display: define( 'WP_DEBUG_DISPLAY', false );. This ensures that while errors are still logged, they are not shown to users on the website.

Additionally, you can add @ini_set( 'display_errors', 0 ); to reinforce this behavior. This combination keeps your website professional and secure while still providing the necessary information in the debug log for administrators and developers.

Advanced Debugging with SCRIPT_DEBUG

For developers working with JavaScript and CSS, WordPress offers an additional constant: define( 'SCRIPT_DEBUG', true );. By default, WordPress loads minified versions of scripts and styles. Enabling script debugging forces WordPress to load the full, non-minified versions, which are easier to inspect and debug.

This setting is valuable if you are working on theme or plugin development and need to trace how scripts and styles behave. It is not commonly needed by general users but can make a big difference for developers troubleshooting frontend issues.


In summary, enabling WordPress debug mode is a straightforward but powerful way to troubleshoot and maintain your website. By editing the wp-config.php file, you can display errors, store them in logs, and keep your site looking professional even during issues. Used properly, debug mode is one of the most important tools for keeping WordPress secure, stable, and developer-friendly.

Enable registration in settings - general