WordPress has an inbuilt debugging system that can help detect most WordPress errors. If you're having problems with your WordPress website and you're unsure of the cause, it might be a good idea to enable debugging and then check the debug log. This article explains how to enable debugging in WordPress.
Official WordPress Documentation
WordPress has excellent documentation about debugging that we recommend reading: Debugging in WordPress. It covers all the aspects of debugging and how to set it up.
We do recommend everyone to read the full article about debugging on the official WordPress site that is mentioned above. However, here we also provide a short summary of the steps to enable debugging for your quick reference.
1. Make a backup of your wp-config.php file (located in the folder with WordPress installation on your server).
2. Edit wp-config.php and add the following code snippet.
// Enable WP_DEBUG mode
define( 'WP_DEBUG', true );
// Enable Debug logging
define( 'WP_DEBUG_LOG', true );
// Disable display of errors and warnings
define( 'WP_DEBUG_DISPLAY', false );
@ini_set( 'display_errors', 0 );
Note that you must add this code snippet above the line that says /* That’s all, stop editing! Happy blogging. */ in wp-config.php file.
3. Reproduce the problem or error that you experience one more time.
4. Download and review the file with a debug log.
Debug Log Location
If you enabled debug logging, you'll find your log files in /wp-content/debug.log. However, the location of the log file might be different with some hosting providers. If you cannot find the debug.log file in the wp-content folder, please reach out to your hosting support and ask where debug logs are saved.