You can locate and view the WordPress debug log to identify specific errors, warnings, and notices occurring on your site. This process allows a Site Administrator to pinpoint the cause of issues like the "White Screen of Death" or other backend failures within the WordPress environment.
Before you begin
You will need:
Administrator access to your WordPress site.
Access to your site's files via an FTP client or a File Manager (such as those provided in your hosting control panel).
Access to the
wp-config.phpfile located in your WordPress root directory.
Locate the debug log file
The location of the debug log depends on whether the WP_DEBUG_LOG constant is enabled in your configuration.
Access your site's files using an FTP client or File Manager.
Navigate to the root directory of your WordPress installation (usually
public_htmlorwww).Locate the
wp-config.phpfile.Open the file and search for the following lines:
define( 'WP_DEBUG', true ); define( 'WP_DEBUG_LOG', true );
If
WP_DEBUG_LOGis set totrue, the log file is typically located in thewp-contentfolder.Navigate to
wp-content/and look for a file nameddebug.log.
Read the debug log
Once you have located the debug.log file, you can open it to review the recorded errors.
Open the
debug.logfile using a text editor.Scroll to the bottom of the file to see the most recent entries.
Look for lines starting with
PHP Notice,PHP Warning, orPHP Fatal error.Identify the file path and line number provided in the error message to determine which plugin or theme is causing the issue.
Warning: Only enable WP_DEBUG and WP_DEBUG_LOG for troubleshooting purposes. Leaving these settings enabled on a live production site can expose sensitive system information to the public.
If you cannot find the debug.log file
If the file does not exist in the wp-content folder, it usually means the logging feature is not enabled.
Open your
wp-config.phpfile.Ensure the following lines are present and set to
true:define( 'WP_DEBUG', true ); define( 'WP_DEBUG_LOG', true );
Save the file and refresh the page on your website where the error is occurring.
Refresh the page several times to trigger the error again, then check the
wp-contentfolder for the newly generateddebug.logfile.
Limitations
The debug.log file only records errors that occur while the WP_DEBUG constant is set to true. If you are looking for errors that occurred before you enabled these settings, they will not appear in the log. Additionally, some hosting environments may have specific security configurations that prevent the creation of log files in certain directories.
