How to Enable and Disable Debug Mode in WordPress

WordPress is an impressive content management system that has built-in features to manage content, features, design, SEO, and more. But it is also immune to errors and bugs when you try third-party plugins and themes. So, there is also a debug mode in WordPress to identify and fix errors. Whenever you want to find issues, you need to enable the debug mode. Once you are done, disable it. In this detailed article, I will explain Debug mode of WordPress, its benefits, and how to enable debug mode in WordPress.
When you enable the Debug mode, it will start showing error messages and warnings on your website. These warning and error messages will help you fix issues on your website. You may see errors related to undefined variables, PHP errors, and deprecated functions. By looking at error messages, you can quickly identify errors and fix problems.
Best Managed WordPress Hosting
WPEngine is the best and most secure managed hosting providerIt is important to note that making a stanging website is a good idea for testing changes and troubleshooting any issues. Avoid making changes to your live website to keep it functional for your visitors. Once you have identified and fixed all the issues, turn off debug mode. Leaving it on will impact the performance of your website. Debug mode can also reveal sensitive information about the code and settings of your website.
How to enable debug mode in WordPress?
To enable the debug mode in WordPress, you need to edit the wp-config.php file located on the root of your website. You can either use the File Manager of your hosting software or FTP to access WordPress files.

In the wp-config.php file, you need find the following line.
define( 'WP_DEBUG', false );
You need to change false to true and add another line for WP_DEBUG_LOG. So, the line will become something like below.
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true);
WP_DEBUG_LOG is a companion function to WP_DEBUG that saves error messages to a debug.log log file. On your wp-config file, it will look like the screenshot below.

Now save changes to the file. These changes will start writing all the errors and notices to a log file located under the public_html/wp-content/debug.log. Access the log file to find out the issues.
How to Disable debug mode in WordPress?
After you have fixed the issues, you need to disable the debug mode by reverting the changes made to the wp-config file. Change WP_DEBUG to false and remove the line added for the WP_DEBUG_LOG.
define('WP_DEBUG', false);
What are the types of errors that can be fixed using the debug mode in WordPress?
When you enable debug mode, it will start showing HTTP errors, Syntax errors, and Database errors. So, you can easily fix errors caused by incorrect use of code syntaxes, Plugin and theme conflicts, issues related to the website’s database, or issues related to the website’s server. It is a really important option to fix the White screen of death in WordPress, internal server error, and fix the error that says ‘Error establishing a database connection.’
As I already said, enabling debug mode affects the performance of your website because it generates additional information and error messages. So, I recommend disabling debug mode once you are done with troubleshooting.
Leave a comment
Comment policy: We love comments and appreciate the time that readers spend to share ideas and give feedback. However, all comments are manually moderated and those deemed to be spam or solely promotional will be deleted.