Share

WordPress Tip #3: How to Fix the “There Has Been a Critical Error on This Website” in WordPress

Encountering the “There has been a critical error on this website” message in WordPress can be alarming. It typically occurs due to issues with plugins, themes, or PHP errors, rendering your site inaccessible. But don’t worry—there are simple steps you can take to troubleshoot and fix this error. In this guide, we’ll walk you through various methods to resolve the issue, get your WordPress site back online, and ensure smooth future operations.

What Causes the “Critical Error” in WordPress?

The “critical error” message is a generic notification indicating that something on the backend of your WordPress site has malfunctioned. Some of the most common reasons include:

  • Plugin conflicts: A recently installed or updated plugin may conflict with your WordPress installation or other plugins.
  • Theme issues: If a new theme or an update to your existing theme contains code errors, it can trigger this message.
  • PHP errors: Running an incompatible version of PHP or errors in PHP code can lead to critical issues.
  • Exhausted memory limit: If your website exceeds the allocated memory limit, WordPress may be unable to execute necessary scripts, resulting in an error.
  • Corrupted WordPress files: Corruption in core WordPress files can also lead to critical errors.

Step-by-Step Guide to Fixing the “There Has Been a Critical Error on This Website”

Step 1: Enable WordPress Debug Mode

The first thing you should do when facing a critical error is enable debugging mode in WordPress. Debugging will display more detailed error messages, which can help pinpoint the issue.

To enable debug mode:

  1. Access your website via FTP (using a tool like FileZilla) or your hosting provider’s file manager.
  2. Navigate to the root directory (often called public_html).
  3. Locate and edit the wp-config.php file.
  4. Find the line: define( 'WP_DEBUG', false );
  5. Change false to true, so it looks like this: define( 'WP_DEBUG', true );

Now, reload your website. Instead of seeing the generic error message, you’ll get more specific information that can help you track down the source of the problem.

Step 2: Deactivate All Plugins

If you suspect a plugin conflict is causing the error, deactivating all plugins is a good next step. Since you can’t access your WordPress dashboard, you’ll need to do this manually through FTP or your hosting provider’s file manager.

  1. Log into your website via FTP or your hosting control panel.
  2. Navigate to the wp-content folder.
  3. Rename the plugins folder to something like plugins_backup. This will automatically deactivate all plugins on your site.
  4. Check your website. If the error disappears, one of your plugins is the cause.

To identify the problematic plugin, follow these steps:

  1. Rename the plugins_backup folder back to plugins.
  2. One by one, rename each plugin’s folder to deactivate them and check your website after each change.
  3. Once you find the plugin causing the error, delete it or contact the developer for support.

Step 3: Switch to a Default WordPress Theme

If deactivating plugins didn’t work, the issue could be related to your theme. Switching to a default WordPress theme (like Twenty Twenty-One) can help determine whether the theme is causing the error.

Here’s how to switch themes manually:

  1. Access your website via FTP or your hosting file manager.
  2. Navigate to the wp-content/themes folder.
  3. Download a backup of your current theme (in case you need it later).
  4. Delete the folder of your active theme.
  5. WordPress will automatically revert to a default theme (if it’s installed). If not, you may need to download and upload one manually.

Check your website. If the issue is resolved, your theme may have been the problem.

Step 4: Increase PHP Memory Limit

If the error persists, it could be due to a memory limit issue. Increasing the PHP memory limit can resolve this.

To increase your PHP memory limit:

  1. Access your wp-config.php file via FTP.
  2. Add the following line of code just above the line that says /* That's all, stop editing! Happy publishing. */:phpCopy codedefine( 'WP_MEMORY_LIMIT', '256M' );

This increases the memory limit to 256MB, which should be enough for most WordPress websites.

Step 5: Reinstall Core WordPress Files

Sometimes, core WordPress files can get corrupted, leading to critical errors. Reinstalling these files can fix the issue.

  1. Download a fresh copy of WordPress from the official website.
  2. Extract the downloaded files to your computer.
  3. Do not overwrite the wp-content folder or the wp-config.php file.
  4. Upload the remaining files via FTP to your website’s root directory, overwriting the existing files.
  5. Check your website again to see if the error is fixed.

Step 6: Contact Your Hosting Provider

If none of the above methods work, it may be time to contact your hosting provider for help. They can check server logs and identify if any server-side issues, such as permission problems or database errors, are causing the critical error.

Preventing Future Critical Errors

To prevent this error from happening again, follow these best practices:

  • Keep backups: Regularly back up your WordPress website to avoid data loss and have the ability to revert to a previous version if something goes wrong.
  • Test updates: Always test plugin, theme, and WordPress core updates on a staging site before applying them to your live site.
  • Limit plugins: Only install necessary plugins from reputable sources, and avoid using outdated or unsupported plugins.
  • Monitor server resources: Keep an eye on your website’s performance and ensure your hosting plan offers enough memory and resources for your site’s needs.
  • Update PHP: Make sure you’re using the latest supported version of PHP to ensure compatibility with WordPress.

Conclusion

The “There has been a critical error on this website” message can be daunting, but it’s usually fixable with the right approach. By following the steps outlined in this guide—enabling debug mode, deactivating plugins, switching themes, increasing memory limits, and reinstalling core files—you can identify and resolve the issue quickly. And by following best practices for WordPress maintenance, you can help prevent this error from occurring in the future.

With these tips, you should have your WordPress website up and running smoothly in no time!

You may also like