If you are facing issues with your WordPress site like a white screen of death is being displayed when errors are reached, enabling debugging to figure out what is wrong, is a good idea. When debugging is enabled in WordPress, detailed error messages are displayed, and you can also write them in a separate log file.
To enable debugging in your site please follow the process below.
Locate the wp_config.php.
The wp_config file is located in the root of your WordPress file directory and contains your website’s base configuration details, such as database-connection information.
Open the config file
Open the wp_config.php file and then try to locate a specific comment /* That’s all, stop editing! Happy blogging. */ “. Above this, you have to enter a small code to enable debugging
Enable Debug mode
To enable debug mode set the WP_DEBUG constant to be true. The value of wp_debug is false by default. Write the following code in the config file.
Now check your website and if any errors are being generated, they will be displayed at the top of your page.
Write error messages to the log file
If you want to save the errors generated by the WP_DEBUG in a separate file for later analysis, write the code below in the wp_config file.
A log file named debug.log is generated in the wp-content directory.
Note: For WP_DEBUG_LOG to do anything, WP_DEBUG must be enabled (true).
Disable debug info from displaying on the frontend
It controls whether to display debug messages inside the HTML of the page or not. To review errors later use WP_DEBUG_DISPLAY in conjunction with the WP_DEBUG_LOG.
Write the following code in the wp_config file to display the error messages.
define( 'WP_DEBUG_DISPLAY', true);
Note: For WP_DEBUG_DISPLAY to do anything, WP_DEBUG must be enabled (true).