6 Fixes for Critical Error on WordPress Websites

In the midst of working on your website, you may come across a message that reads “there has been a critical error on your website” and your site suddenly becomes inaccessible. While it’s natural to panic when you experience such a critical error, rest assured this is one of the common WordPress errors that can be resolved.

So let’s get going to quickly restore your website.

How to regain access to your site after a critical error

The following message will be displayed on the screen.

There has been a critical error in WordPress message

Notice that WordPress sends instructions to the admin email on how to regain access to your site. For this reason, it’s important to always keep the site admin email updated. The email will contain a link to access the WordPress dashboard in troubleshooting mode.

Once you regain access to your site, you can take the following steps to rectify the critical WordPress error.

1. Disable all the plugins

Sometimes, activating an incompatible plugin may result in a critical WordPress error. Therefore, to rule out any plugin conflict, you should deactivate all the plugins and then reactivate them one by one.

If the error recurs, you know for sure which plugin is causing the problem. But what if you don’t have access to your admin dashboard? In this scenario, you can use your FTP client or your hosting file manager to access the wp-content folder in your WordPress installation.

Now, within the wp-content folder, you should rename the Plugins folder to some other name like plugins.old. This will instantly deactivate all the plugins. Check your website. If it’s accessible means that one of the plugins was causing the error.

You should restore the plugin folder to its default name and then log into your site. All the plugins will be in a disabled state. Reactivate the plugins one by one as explained above.

2. Switch to the default theme

The second solution is switching over to the default WordPress theme. It could be that you inadvertently changed some theme file that resulted in the critical error. Switching to the default theme will help to resolve this.

3. Check for memory errors

The critical error can also occur if the available PHP WordPress memory is less than required. The minimum recommended memory for WordPress to run smoothly is 256 MB. But some hosts allocate only 64 MB of memory which is likely to cause errors on the site especially when running memory-intensive plugins or uploading large files.

You can visit the Tools > Site Health > Info > Server panel to check out the available memory. If it’s less than 256 MB, you should increase it.

Visit your WordPress installation using your FTP client or the file manager. Then add the following snippet in the wp-config.php file:

define('WORDPRESS_MEMORY_LIMIT', '256');

This will increase the PHP memory to 256 MB. If this does not work, ask your web host to increase the available PHP memory.

4. Check the maximum file upload size

A related problem could be the limit of the maximum upload file size limit which when exceeded results in a critical error on your WordPress website. You can know the maximum file upload size limit when you try to add a media file by navigating to Media > Add New.

If the limit is less than the file size that you’re trying to upload, it can cause an error. Hence you should increase the file size limit by adding the following code snippet in your .htaccess file (the file is located in your root website directory):

php_value upload_max_filesize 128M
php_value post_max_size 128M 
php_value memory_limit 256M 
php_value max_execution_time 300 
php_value max_input_time 300

This will increase the maximum file size limit to 128 MB, PHP memory limit to 256 MB, and also increase the execution time.

5. Rule out database errors

If the WordPress database gets corrupted, it will make your site unreachable and throw an error on the screen. The first thing to do is to repair your database.

Once this is done, try to access your site. If it’s accessible, that’s great otherwise you can try the next solution.

6. Turn on the error log

Sometimes the critical error may require further investigation to get to the root of the problem. In this case, it’s a good practice to turn on the error log to determine the source of the error.

Add the following snippet in the wp-config.php file located in the WordPress installation directory.

define('WP_DEBUG_LOG', true);

Now, a debug log file will be created in the wp-content folder. You can access the file to check what is causing the critical error on your site.

Once the error is resolved, remember to remove the snippet from the wp-config.php file since the log file is publicly viewable.

Seek professional help

Hopefully, one of the solutions listed above helped to troubleshoot the critical error on your WordPress website. But sometimes, an error can be stubborn and refuses to go away. In this situation, it’s recommended to opt for a reliable WordPress troubleshooting service to resolve the critical error quickly and professionally.

If you have any questions or feedback to share, I would love to read them in the comments below.

Also read:

  1. How to fix image upload errors in WordPress
  2. 6 fixes to the invalid JSON response error
  3. Four ways to fix the 404 permalinks error in WordPress
  4. Fix this site can’t be reached WordPress error

Download the WordPress SEO eBook

Go from WordPress SEO Zero to Hero in no time. Also receive 2 Bonus PDFs with this free eBook.

Give it a try. You will thank yourself later.

About Trishan Mehta

Trishan Mehta is a WordPress fanatic since 2009. When not WordPressing, he is busy exploring hidden natural getaways whenever he can grab an opportunity. You can grab his WordPress SEO eBook to get up to speed with WordPress SEO.

Leave a Comment