This article explains how to activate WordPress debug mode and generate the debug.log file. You likely found this article because you are experiencing a fatal error or a blank white page on your WordPress site.
You can enable the WordPress “debug mode” by editing a few lines in the wp-config.php file of your WordPress installation.
To enable debugging mode in WordPress, follow the steps:
- Login to cPanel or log in to your site via FTP
- Use the cPanel File Manager or your FTP client and edit the file wp-config.php
- Copy the lines below to the file wp-config.php or if they already exist, change their values:
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );
IMPORTANT: Make sure that you copy the lines exactly as shown, don’t forget any semicolon or other characters!
4. Paste the copied lines directly above the line:
/* That's all, stop editing! Happy publishing. */
Use caution when using the step below. It will display PHP error messages on the frontend and your visitors will also be able to see these errors. For security reasons, always disable WP_DEBUG when you have fixed your site errors.
If you want to see the debug log errors directly on the screen instead of needing to look into the debug.log file, change the line
define( 'WP_DEBUG_DISPLAY', false );
to
define( 'WP_DEBUG_DISPLAY', true );
If this works, you will see the relevant errors in your debug.log file and/or displayed on your screen. This will help you to find the conflict and resolve the fatal error.
You can find more detailed instructions about how to enable the WordPress debug mode at https://wordpress.org/support/article/debugging-in-wordpress/.