Introduction
Debugging mode in WordPress is a feature that allows developers to troubleshoot and fix errors or issues on their WordPress website. When debugging mode is turned on, WordPress will display error messages, warnings, and notices on the front end of the website, making it easier to identify and fix problems.
It’s important to note that when debugging mode is turned on, it can expose sensitive information about your website and server, so it should only be used during development and testing. Once you have resolved the issues and your site is live, debugging mode should be turned off.
When debugging mode is turned on, WordPress will save debugging information to a log file (debug.log) in the wp-content directory, this way developers can check what is causing the error.
Additionally, when debugging mode is on, WordPress will not use the caching system, this allows developers to see the changes they make in the website without clearing the cache every time.
How to turn Debugging Mode on in WordPress
To turn on debugging in WordPress, you can edit the wp-config.php file located in the root directory of your WordPress installation.
Add the following line of code at the top of the file, before the line that says “require_once(ABSPATH . ‘wp-settings.php’);”:
define( 'WP_DEBUG', true );
This will turn on debugging mode, and any errors or warnings will be displayed on the front end of your website.
You can also specify where the debugging should be saved by adding the following lines of code, after the line you just added:
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );
This will save the debugging information to a debug.log file in the wp-content directory and turn off the display error on front end.
Remember to remove these lines or set WP_DEBUG to false when you are done debugging and your site is live.