How to resolve WordPress error faced while removing a plugin - Deletion failed: There has been a critical error on this website.

WordPress is a really famous tool for making websites. Lots of people use it to make all sorts of websites, from basic ones to really complicated ones.

But, even though WordPress is super popular, it's not perfect!

Sometimes, you might see a scary message saying something like, "Uh-oh! Something's wrong with your website. Check your email for help."

This article will help you solve this big problem in WordPress fast. We'll also talk about why it happens and how you can stop it from happening again. So, let's start fixing it right away!

 

What's a Critical Error in WordPress?

A critical error in WordPress is a problem that stops it from working properly because it can't load all the things it needs.

Before, when this happened, you'd see a scary message or just a blank screen. Many beginners had a hard time fixing this on their own.

To help out, WordPress now has a feature that spots when a plugin or a theme is causing a big problem. It sends an email to the website admin. If you don't see the email, check your spam folder.

In the email, you'll find more details about what's wrong. It might be a plugin or theme not working right, or maybe there's a problem with the database or not enough memory. The email explains where the problem is happening, like which line of code.

Plus, the email includes a link to help you access your site in recovery mode. You can use this link to log in and fix the issue in your WordPress dashboard.

 

What Causes the "There has been a critical error on this website" Error?

Whether you're making a WordPress site yourself or getting help from pros, the process is similar. There are lots of moving parts, so it's important to know what might cause this big error and how. Here are some reasons:

 
  • Problems with WordPress Core Files: If any of the main WordPress files are damaged or missing, you might see critical errors. This can happen if you tried to update your site and it didn't work, or if you messed with the core files.
  • Issues with Themes or Plugins: Sometimes, messed-up theme or plugin files can cause errors. Most good plugins and themes don't cause problems, but conflicts or custom code might.
  • Mistakes in Custom Code: If you added your own code and made a mistake, it could break things. Check recent changes to find errors.
  • Malware: Viruses can mess up your site and cause errors. Make sure to scan your site and clean out any bad code.
  • Not Enough Memory: If your site runs out of memory while doing something, you might get an error.
  • Using an Old PHP Version: If your site uses an old version of PHP, it might not work well. Upgrading to a newer version can help.
  • Incompatible PHP Version: Sometimes, old or custom code doesn't work with newer versions of PHP. Updating PHP might break older sites.
  • Problems with the Database: Issues with your site's database, like corruption or incomplete updates, can cause big errors. This could happen if your server crashes or updates don't finish properly.
 

How to Fix the "There has been a critical error on this website" Error?

To solve a major problem in WordPress, you first need to find out what's causing it. WordPress might send you an email with more information about which file and code line is causing trouble, but don't worry if you didn't get it.

There are 10 ways to find and fix the big problem on your WordPress site.

 

1. Look at Error Logs

Error logs are files that keep track of different events on your web server. When something goes wrong like a server issue or a problem with your website's software, details about it are written in these logs.

Checking error logs is important when trying to figure out what's causing technical problems, like critical errors on a WordPress site. Tech experts use these logs to get info about errors, warnings, and other issues happening on your server. They help find out what's causing the trouble.

You can check error logs in two ways in WordPress. First, if you have cPanel, you can find the error log file in the file manager. Here's how:

Step 1: Log in to your cPanel account.

Step 2: Click on the File Manager icon.

 

 

Step 3: Go to the Public_html folder.

Step 4: Look for a file called error_log.

 

 

Step 5: Right-click on error_log and open it to view.

 

Second, if you don't have cPanel, you can use an FTP client like FileZilla. Go to your WordPress installation directory and look for the public_html. Check for files named error_log.

 

 

2. Turn Off the WordPress Plugins

When you see a critical error, often it's because of a plugin. If you have lots of plugins on your site, finding the troublesome one can feel hard.

But here's an easy way: turn them all off and see if that fixes it. If it does, turn them back on one by one until the error comes back. Then you'll know which one's causing the trouble!

To turn off plugins from your dashboard, go to Plugins > Installed Plugins. Tick the checkbox at the top to select them all, then click Bulk Actions > Deactivate. This should stop any conflicts and get your site back to normal.

 

 

You can also choose to delete them, but then you'll need to reinstall them manually or restore a backup.

 

To turn them back on one by one, go back to Installed Plugins and click Activate on each one.

You can do the same thing through FTP or File Manager:

Step 1: Log in to your site using FTP.

Step 2: Find the plugins folder in wp-content.

Step 3: Rename the plugins folder to plugins-old and check if your site works.

 

 

Step 4: Rename it back to "plugins". The plugins should still be off, so you can go to your dashboard and turn them on one by one. If they turn back on by themselves, rename individual plugin folders with _old until your site is fixed.

 

3. Change to a Basic Theme

Sometimes, a big error might happen because of a problem with your theme. To check if that's the case, you can temporarily get rid of it and switch to a simple theme that comes with WordPress. This usually solves the problem right away.

But before you do this, make sure to save a backup of your site. This way, you can get your theme back later. Just reinstalling it might make you lose any changes you made to how it looks.

If you can access your WordPress dashboard, it's easy to do. Go to Appearance > Themes, pick the theme, and click Delete.

 

 

If you can't see this option, try downloading and using a different theme. It's safest to try one of the basic ones like Twenty Twenty-One.

If you can't access your WordPress dashboard, follow these steps with FTP:

Step 1: Connect to your site using FTP.

Step 2: Go to wp-content/themes. Here, you can either rename your theme folder (so you can turn it back on later) or just delete it.

Step 3: If you don't have another theme saved, download Twenty Twenty and put its files into the themes folder.

Your site should now look like Twenty Twenty. If it's working fine now, you know there was a problem with your old theme.

To get your old theme back, just reinstall it or change the folder's name back to what it was before.

 

4. Increase PHP Memory Allowance

Even if it seems like a plugin or theme is causing your website to not work properly, often it's actually the PHP memory limit that's causing the big "There has been a critical error on this website" message.

What's PHP's memory limit?

WordPress puts a strict limit on how much memory a single PHP script can use on your web server. When it reaches this limit, you'll see the critical error or the white screen of death.

 

To increase your PHP limit:

Step 1: Open your wp-config.php file.

Step 2: Go to the bottom of the file and set your memory limit: define( ‘WP_MEMORY_LIMIT’, ‘128M’ );

 

 

Step 3: Save the file.

Then, check your website to see if the error goes away. If it doesn't, you can try setting the memory limit to 256MB.

But be careful when increasing your PHP memory limits. If you set it too high, it could slow down your website or cause issues with your hosting provider's limits.

 

5. Update PHP Version

Using an old version of PHP can break your site and cause other problems too. It's best to have your site running on the newest version of PHP that WordPress supports, which is currently PHP 7.3 to 8.0.

Some WordPress users like to stick with PHP 7.4 because they worry about whether their themes and plugins will work with newer versions. Usually, this isn't a problem. But if you're still using PHP 5.x, you really need to upgrade because it can cause serious issues.

Upgrading PHP is a big deal, so be sure to back up your site before you try it. If you're an AccuWeb client, you can upgrade PHP from cPanel without any complicated steps.

 

To change the PHP version for multiple domains in cPanel, do this:

Step 1: Log in to your cPanel account.

Step 2: In the "Software" section, click on the "MultiPHP Manager" icon.

 

 

Step 3: On the "MultiPHP Manager" page, choose the domains you want to change from the list.

Step 4: From the drop-down menu for "PHP Version," pick the PHP version you want for the selected domains.

 

 

Step 5: Click the "Apply" button to make the changes.

Note: Make sure the PHP version you choose works with your website and any plugins you're using. If your site relies on old functions or features, switching to a newer PHP version could cause issues.

After you change the PHP version, test your website well to make sure everything still works right. Check for any error messages or problems with specific parts of your site.

 

6. Use Debug Mode to Find Errors

If you're having problems with WordPress, one of the first things to do is turn on debugging. With debug mode on, you can see any PHP errors happening on your site. This can help you figure out what's causing the issue.

If you can't access your dashboard, you also need to turn on the debug log. This writes down all PHP errors to a file.

If you're hosting with AccuWeb, enabling debugging is simple.

Step 1: Use your hosting provider's FTP or file manager to get to your WordPress files.

Step 2: Find and open the wp-config.php file in the main WordPress folder.

 

 

Step 3: Look for this line in the wp-config.php file:

 

define('WP_DEBUG', false);

If you don't see it, you can add it manually.

Step 4: To turn on WP_Debug mode, change "false" to "true" like this:

 

define('WP_DEBUG', true);

 

 

Step 5: To turn off WP_Debug mode, change it back to "false" like this:

 

define('WP_DEBUG', false);

 

Step 6: Save the changes to the wp-config.php file. If you used FTP, upload the modified file back to your server.

Now, debugging is on, and errors will be written to the log. You can find the debug log in the wp-content folder with the name debug.log.

 

7. Restore the Website From a Backup

With this method, you'll bring back your website files from a backup. Having a backup is super important, especially when you face errors like this.

Using cPanel:

Step 1: Log in to your cPanel account.

Step 2: In the Files section, click on Backups.

 

 

Step 3: Under "Restore a Home Directory Backup," click on Choose File, pick your home directory backup file, and click Open.

Step 4: Once your backup file's name appears, click on Upload. This will restore your home directory backup.

 

 

Step 5: You'll see the progress as your files are being restored.

After that, you need to restore the database. Go to the Database backups section, select the backup data you want to restore, and click Upload.

 

 

Using WordPress plugins

If you have a backup plugin like UpdraftPlus, and you prefer using it, access your WordPress admin through the recovery mode URL from the error email.

Navigate to the backup plugin's panel and find the restore option. Different plugins might have different layouts, but usually, you just need to pick a backup file and restore your website.

You can also use a migration plugin like All-in-One WP Migration. It makes it easy to import .wpress backup files from local storage. Go to All-in-One WP Migration -> Import, and select the .wpress file you want to upload.

 

8. Reinstall WordPress

Reinstalling WordPress is a more advanced way to fix problems with your website if you've tried everything else and still have critical errors or issues.

This can help with problems caused by corrupted core files, updates that didn't finish, or conflicts that are hard to find. But, you should only do this if nothing else has worked.

 

Here's how to reinstall WordPress:

Step 1: Before doing anything big like this, make sure to back up your whole website. This way, if anything goes wrong, you can go back to how your site was before.

Step 2: Use an FTP client like FileZilla or log into your cPanel account to connect to your server.

Step 3: Go to the official WordPress website (wordpress.org) and download the latest version of WordPress. Unzip the downloaded file on your computer.

Step 4: In your FTP client, go to the main folder where WordPress is installed. Delete everything except for the wp-content folder and the wp-config.php file. These folders keep your themes, plugins, and settings.

Step 5: Upload all the files you unzipped from the new WordPress download into the main folder. This will replace the files you deleted.

Step 6: After uploading the new files, go to your website to check if it's working right. You might see the WordPress setup screen if everything went well.

Finally, finish the setup process as instructed by WordPress and then bring back your content and settings.

 

9. Clear Your Website's Cache

Caching helps your website load faster, which is usually a good thing. But sometimes, the cache can get messed up and cause errors on your site.

When this happens, a simple fix is to clear the cache. This should get rid of the problem and make your site work properly again.

Don't worry: Once you clear the cache, your pages will be cached again, making your site load quickly. Clearing the cache just gets rid of the messed-up files.

 

Here's how to do it:

Step 1: Log in to your cPanel.

Step 2: Use the search bar and type "cache."

Step 3: You'll see LiteSpeed Web Cache Manager (LSCache) as the search result.

Step 4: Click on LiteSpeed Web Cache Manager to open a new page in your cPanel.

 

 

Step 5: Scroll down to Flush LSCache and click on the Flush All button.

 

 

Step 6: You might see a warning message. Click OK to continue.

Step 7: Now, your website's cache is cleared.

 

Conclusion

It can be frustrating to encounter the error message "Deletion failed: There has been a critical error on this website" while trying to remove a plugin in WordPress. However, there are steps you can take to resolve this issue.

First, back up your WordPress website to prevent data loss. Then, try deactivating the plugin from the WordPress dashboard and deleting it again. If the error persists, you can use FTP to manually delete the plugin files from the server.

Additionally, clearing the website's cache, upgrading the PHP version, changing the themes, increasing the PHP memory limit, and scanning for malware can help eliminate any underlying issues causing the error.

By following these troubleshooting steps, you can effectively address the "Deletion failed: There has been a critical error on this website" error and regain control over your WordPress website.


Was this answer helpful?

« Back

chat