WordPress provides a debug tool to help discover what may be the cause of an error on your website. This tool can display information on your live website, however, this is not recommended if your website is live to the public. Instead, it's recommended to create a debug log file. You can then check that log file to determine the cause of the issue you're attempting to resolve.
This article walks you through how to enable Debug mode and write to a log file without disturbing your live website.
Enabling DEBUG mode
- Log into your server via SSH or FTP.
- Edit the wp-config.php file using SSH or your FTP client.
- Near the bottom of the file you'll see the following:
define( 'WP_DEBUG', true ); define( 'WP_DEBUG_DISPLAY', false ); define( 'WP_DEBUG_LOG', true );
It's not recommended to change WP_DEBUG_DISPLAY to true. This is because any errors will then display on your live website. By enabling WP_DEBUG_LOG, you can view the same errors in your /wp-content/debug.log file.
- When an error is thrown in WordPress, it will write to a file titled debug.log. This file is located in your /wp-content/ directory. Open this file using SSH or your FTP client to view the debug report.
Viewing your debug log using a plugin
There are also several plugins that help to debug your site and view your debug log. View the following article for information on how to manage and install a plugin.
When searching for a plugin, try typing in 'debug' as a search term. There are many different options for you to choose from.