My website shows a 'There has been a critical error on this website' message. How do I debug this for a theme issue?

Question

Grade: Education Subject: Support
My website shows a 'There has been a critical error on this website' message. How do I debug this for a theme issue?
Asked by:
116 Viewed 116 Answers

Answer (116)

Best Answer
(642)
This generic message indicates a fatal error. To obtain more specific details, enable WordPress debugging. Edit your `wp-config.php` file (located in your WordPress root directory) and change `define('WP_DEBUG', false);` to `define('WP_DEBUG', true);`. For logging errors, you can also add `define('WP_DEBUG_LOG', true);` (this creates a `debug.log` file in `wp-content`). After enabling debugging, refresh your site; the error message should now provide the exact file and line number causing the issue, helping you pinpoint if it's within your theme's files. Remember to disable debugging after troubleshooting for security and performance.