6 fixes for WordPress Critical Error Message
When you arrive at the website and it shows the message “There’s been a critical error on this website”, it usually happens after updating plugins, sometimes after theme updates or often after WordPress core file updates.
There are so many places and possibilities for the cause of this in WordPress, but I’ve compiled a list of the six most common places to look to find out what’s causing the problem. Hopefully it’s helpful enough that you’ll be able to find and fix it on your own website.
1 – Review the email from WordPress notifying you of the error
- usually WordPress automatically sends an email to the site admin address with links in it. These links allow you to visit the website in what’s known as “Safe Mode”; it shows your site with the plugins superficially deactivated. Open one of these links and see if there’s any errors on the screen that give you indications of what’s wrong.
- also in that email, towards the bottom you may find a list of errors. Read them carefully line by line to see if you can spot what might be causing the error. Especially looking in the lines after ‘wp-content’–this tells you maybe the name of the plugin or the theme which is causing the error. This set of error notations is giving you directions to EXACTLY where in your WordPress installation files in cPanel that you’ll be able to find the problem.
2 – Check the error messages on the screen when you visit the website
-
- unless debugging is turned on (see #6 below) for the site, these error messages are going to be pretty generic and not necessarily helpful other than telling you there’s been a critical error. Move on to the next step in troubleshooting–
3 – Review the error log
- navigate in your cPanel to your main website folder (see image below)
- look underneath all the folders listed on the right side of the page (past wp-content, wp-admin, etc.) and find the file called ‘error_log’
- click the file once to highlight it
- click the pencil icon EDIT in the menu at the top of the page (we’re trying to avoid downloading the file and having to open it on a text editor program by doing this)
- this file will open in a new window. It may have a little data or a lot of data in it. The oldest items are at the top of the pages and newest at the very bottom, so scroll down the page to the most recent entry.
- read the last few entries with today’s date and look for clues as to where to find the problem–look for names of plugins or names of themes. This information tells you EXACTLY where you’ll find the culprit within your WordPress installation files. (i.e.:
But what does it all mean?
Example 1(above)— tells me I need to look in my site folder, under the wp-admin folder in the includes folder, for a file called class-theme-upgrader.php and open that file and look on line 484 —BUT looking will not necessarily help you here! My experience tells me that this path of going through all these folders and getting to that file means theres a problem with my theme.
Example 2(below)–This one tells me I need to go to my cPanel website folder in the file manager and go to the wp-admin folder and look for a file called ‘update.php’ and look on line 252 and that there was an error with the theme upgrader. So, I can deduce, again, the problem lies within my theme. That gives me a direction to go in to solve the problem.
4 – Deactivate all plugins
by renaming the plugin file in your wp-content folder. You can rename it simply ‘plugins.1’
- revisit your website after this — if it’s “Alive Again”, then you can deduce that a plugin is causing the problem
- return to cPanel file manager, wp-content folder and rename your plugins folder back to its original name again –‘plugins’
- log into your WordPress dashboard and visit the plugins page
- activate each plugin, one by one and see which one breaks your site again
- be prepared that it may not happen–it may just be a plugin is conflicting with your theme and causing things to break. You won’t find this out until you’ve continued exploring, activating things and waiting for the break to happen again
- if all goes well, move onto Themes troubleshooting
5 – Deactivate your themes by navigating to the wp-content folder again and finding the ‘themes’ folder.
- Double click it to open and see the list of themes that are installed. You can deactivate your active theme by renaming its file name as above, with .1 at the end (i.e.: ‘themenamefile.1’
- revisit your website to see if you can at least view your website. Visit the dashboard. If your theme was the cause of the problem, then this is where you’ll begin exploring making changes to fix your website
- Try activating a different theme on your website or activating one of the default WordPress themes such as Twentytwentyone. If your content appears when you change themes, then the issue is with your regularly activated theme.
6 – Turn on debugging in WordPress
by visiting cPanel and navigating to your public HTML folder or the folder where your website is installed and find a file called ‘wp-config.php’
- click wp-config.php one time to highlight it then select “Edit” from the top menu of your page. This will open a new window
- search in this file for a line that says ‘define( ‘WP_DEBUG’, false); and change the word ‘false’ inside the bracket to say ‘true’ and click SAVE in the upper right hand corner of your page.
- now you can visit your website again and if there are any errors happening on your website, they will show at the top of the screen (front end or dashboard views will both show the errors if there are any.)
- Any errors you see on the screen, read carefully and they will give you the clues to fixing the problem. Look for plugin names, theme names or other clues in the written information. It may look like gibberish, but it is telling you EXACTLY where the problem is in your WordPress directory files.
- remember to return to the wp-config file and change the line that says ‘define( ‘WP_DEBUG’, true);’ back to be ‘define( ‘WP_DEBUG’, false);’ instead again (don’t include the ‘ single quote marks ‘ from those if you are copy/pasting from here)