Fixing WordPress error “There has been a critical error…”

If WordPress detects that your website has encountered a critical internal server error, it will show the message “There has been a critical error on your website”. Fixing this issue can be tricky. It’s usually caused by something you have changed recently. The steps below should help you figure out what is causing the error and fix the problem.

There has been a critical error on your website - WordPress error message.

Enable debugging

The first step is to enable debugging in WordPress, this will give you more information on where the critical error us occurring.

To do this, you will need to log into your website via FTP. You can get your FTP details from your website host.

If you’re new to FTP, we recommend downloading FileZilla. It’s fairly simple to use and gets the job done. After installing, enter your details into the boxes at the top of the screen. The host is usually your website domain name, and the port is usually 21. The username and password will typically be your hosting control panel username and password but may be different depending on your host. You can either ask your host, or log into your hosting control panel to make yourself a fresh FTP account.

You’ll want to edit the wp-config.php file. On FileZilla, you can right-click, then click Edit. This will open the config file in notepad (or whichever is your default program for PHP files). In the file, there should be the following line:

define( 'WP_DEBUG', false );

You will want to change this to true. It should now look like the following:

define( 'WP_DEBUG', true );

Now head back over to your website and refresh the page. The error should now have changed to say something more detailed. This will usually give you an idea of which plugin or which part of the theme is broken.

Check the logs

If the error shown on the front-end of the site does not give enough information, you can check in the PHP error logs. These logs are usually either accessed from the hosting control panel or are available via FTP.

If your website is hosted using cPanel, you can find your PHP errors in the error log section in the cPanel web control panel.

PHP error logs for debugging WordPress critical errors.

The error at the bottom of the log will be the most recent. Usually, if a plugin is causing the issue, the name of the plugin will be mentioned somewhere in the error.

If you don’t have hosting control panel access, you can usually find your PHP error log in the root of your website files. You’ll need to log in via FTP and navigate to the public_html or html or www directory. The error log is usually named error_log. You can download this and open it in Notepad to view the errors.

Disable plugins

Using the method above, you can usually figure out which plugin or theme is causing the issue. If you know the name of the plugin, you can try disabling it and see if the problem stops. However, you usually cannot log into your website when you have this error, so you’ll have to do this manually.

To manually remove a plugin from your website:

  • First, log into your website via FTP.
  • Navigate into the wp-content folder, then plugins.
  • Right click on the name of the plugin you need to disable and click the download button. This will download a copy of the plugin to your computer, just in case you need it in the future.
  • When that has finished downloading, right click and delete the folder.

Once the plugin folder has been deleted, load the page and check if the error still shows. If the error is gone, then it will mean that plugin was causing the issue. Installing the latest version of the plugin can sometimes fix this, or, if that doesn’t work you can install an older version from the WordPress plugin page.