Troubleshooting
Debug errors in WordPress with WP_DEBUG
WordPress decides in the wp-config.php file whether errors are shown on screen, saved to a log or not shown at all. By default they are not shown, which is why you see a blank screen or the message "There has been a critical error on this website." By enabling debugging you will see the real message.
Open wp-config.php from the cPanel File Manager (it is in the WordPress folder, usually public_html). The lines in this article go before the comment /* That's all, stop editing! Happy publishing. */. If any of them already exists (define('WP_DEBUG', false); is almost always there), change its value instead of adding it again.
Save errors to a log (recommended)
Add or change these lines:
define( 'WP_DEBUG', true ); define( 'WP_DEBUG_DISPLAY', false ); define( 'WP_DEBUG_LOG', '/home/USUARIO_CPANEL/wp-debug.log' ); @ini_set( 'display_errors', 0 );
Replace USUARIO_CPANEL with your cPanel username. The first line enables debugging, the second and fourth stop errors from showing on the site and the third saves them to the wp-debug.log file in your hosting's main folder.
Reload the page that fails and open wp-debug.log with the File Manager. What you are looking for is the line with PHP Fatal error: it says which file failed, and from the path (wp-content/plugins/NAME or wp-content/themes/NAME) you know which plugin or theme it is.
If you set define( 'WP_DEBUG_LOG', true );, WordPress saves the log in wp-content/debug.log. It works the same, but that file can be downloaded from the browser; that is why a path outside public_html is better.
Show errors on screen
To see them directly when the page loads, this is enough:
define( 'WP_DEBUG', true );
Any visitor will see the errors, including server paths. Use it only for a few minutes, or on a site that is not live.
I still see a blank screen
If the error happens before WordPress loads (for example, a syntax error in wp-config.php itself or in functions.php), WP_DEBUG never gets to act. Enable PHP error logging from .htaccess or from cPanel as explained in enable PHP error logging.
When you finish
Set define( 'WP_DEBUG', false ); again, remove the other three lines and delete the log file. With debugging enabled the log keeps growing and WordPress runs a little slower.
You may also find useful
- 404 errors on static files slow down browsing Detect missing static resources that trigger PHP and use CPU, serve them as lightweight 404s and gui...
- Diagnose Sodium cryptographic errors in WordPress Tell a missing Sodium extension apart from an invalid argument in sodium_compat before changing the...
- Elementor 3.6.x, historical compatibility issues Historical guide to diagnosing errors that appeared after updating to Elementor 3.6 without attribut...
- Elementor shows a 500 or 503 error when saving changes What causes the "Server Error (500 error)" or "(503 error)" when saving in Elementor and how to fix...
Something wrong or out of date? Tell us and we will review it.