What is the debug mode?
The debug mode is a feature that is included in WordPress by default and is turned off by default.
You can turn on the debug mode if you want to display errors on the front end of your website.
The debug mode is mainly used by developers.
Enabling the debug mode
You can enable the debug mode by using a text editor to open the wp-config.php file.
Open the wp-config file and find the following line of code:
define( 'WP_DEBUG', false );
To enable the debug mode, change FALSE to TRUE.
(Casing doesn’t matter.)
By default, the debug mode is set to FALSE. This is done for security reasons. Remember to set the debug mode back to FALSE after resolving the errors!
Errors can reveal information about your website that not everyone should see. Hackers and malicious scripts, in particular, should not have access to error messages.
You can also save the errors so that you can review them later. WordPress has a built-in feature called the Debug Log, which is already present in WordPress but needs to be activated.
To activate it, add the following line of code below the previously mentioned debug mode line in your wp-config.php file:
define( 'WP_DEBUG_LOG', true );
WordPress will now save ALL errors that occur on visited pages in a file called debug.log, which can be found in the wp-content directory.
If you want to view the errors in the log file, you need to visit the pages where the errors occur.
And if you suddenly see hundreds of errors, don’t panic. If you have many website visitors, all those errors will also be logged every time a page with errors is loaded. So it could be just “one simple error” that you need to address, but it appears multiple times in the log file.
Whether you want to view the errors directly on the respective page or through a log file, it’s possible! Now, you just need to resolve the error.