DO NOT PANIC!
If you have encountered an critical error on your WordPress
There has been a critical error on your website
DO NOT PANIC IF THERE IS A CRITICAL ERROR ON YOUR WRODPRESS!
This WordPress error does not mean in any way that you have lost your files, your installation is intact. That’s why WordPress manages to send you a critical error on your WordPress. This means that your site is still installed on your server or on your web host’s servers .
There are multiple factors that may have cause this error and we will address them here to get your site back on track ASAP!
What may have caused a critical error on your WordPress and how to fix it?
The main cause
One of the main causes of this critical error on your WordPress is trying to access your WordPress site during scheduled updates or while you are running a manual update of your WordPress, Themes and/or Plugins. Your site is therefore put in a secure mode to complete the update without any problem. Thus, a temporary home page has been created, which prevents the system from blocking permanently.
If this is the case just wait until all of the updates are completed. Your website should be back online in no time!
Very common cause
Another very common cause can be the actual update or a new installation of a theme or a plugin. Again as explained before the site is put in a secure mode. If it sees a problem with the update or the new installation.
In this case, you should access your Files Manager in your CPanel. Locate your WordPress installation folder. Go inside the WP-Content folder and finally into the plugins or themes folder. Basically what you want to do is disable the plugins/themes that may have caused this error. For you to disable the plugin/theme you would need to rename the given plugin/theme folder. Simply adding any digit in front of the folder name will do the trick.
Once you are done renaming the folder go back and check to see if your site is back on live. Now it’s only a matter of removing the plugin/theme. You can do so by restoring the older version of it or replacing it with a better solution.
Keep in mind that if you were updating multiple plugins, you will need to rename all of them to identify exactly which one caused the error. You can rename them back to their original names. Do so one by one and refresh your WordPress page until you find the exact plugin causing this error.
In case none of the above applies to you, then you would need to debug the critical error on your WordPress.
There are several different potential ways to fix critical error on your WordPress issue. Knowing that the cause is likely PHP-related, these may involve editing core WordPress files. Even with your site in a broken state, make sure to back it up before implementing any of these suggestions. We don’t want to make it worse!
If you’re able to log in to your website’s backend, that will help immensely. But as your entire site is likely down, you’ll very likely need to access it through FTP (or SFTP).
Contact your web host or look through your hosting dashboard to find your FTP login credentials, and make sure to install an FTP client like FileZilla. You can also access via CPanel’s File Manager to your WordPress installation director
Enable Debug in WordPress
If you’re having trouble with WordPress, one of the first things you should do is enable debugging. With debug mode on, you’ll be able to see the various PHP errors occurring on your site. You can use this to trace back to the root of the issue.
As you may be unable to access your dashboard, you’ll also need to enable the debug log. This will write all PHP errors to a file.
To turn on debugging you need to access the debug log, follow these steps.
- Connect to your site with FTP.
- Find wp-config.php in the root folder and open it with a text editor or IDE.
- Place the following code at the bottom of the document, just before the final message, then save and close the file:
define( ‘WP_DEBUG’, true );
define( ‘WP_DEBUG_DISPLAY’, false );
define( ‘WP_DEBUG_LOG’, true );
Here’s what it will look like when done:
Debugging is now enabled on your site and errors will be written to the log. You can find the debug log in the wp-content folder, named debug.log.
Look for names of your theme or plugins which will point to them being the cause of the critical error on your WordPress or references to a specific file. Even if you aren’t sure what to do with this information, save it someplace — it can help you if you need to reach out for support.
When you’re finished debugging, make sure to remove these lines of code.
Roll Back Your Site
When WordPress errors rear their head, restoring a backup can be a quick and easy way out. While it won’t always solve the issue, it’s definitely worth a shot. And if the problem happens again, you may be able to retrace your steps next time.
How you restore your website all depends on how you backed it up. If you use a plugin, follow the instructions in the documentation. If backups are included with your web host, you’ll likely be able to do it from your hosting dashboard.
Before restoring to your live site, try it on a staging site to ensure that the site is indeed functioning and you’re not overwriting your hard work.
Raise the PHP Memory Limit
Even if a plugin or theme is the cause of your broken website, the PHP memory limit is often the real one to blame.
What is the PHP memory limit? Your web server only has a certain amount of RAM, or memory, so WordPress sets a hard limit on how much memory a single PHP script can take up. When this limit is exceeded, you’ll encounter the white screen of death or the critical error.
While you don’t want to set the memory limit too high and allow misconfigured scripts to slow your site to a crawl, the default value may be far too low. Raising your PHP limit just a bit could instantly fix your broken website.
- Access your site through FTP and open wp-config.php.
- Insert the following code right before the final line and save.
define( 'WP_MEMORY_LIMIT', '128M' );
Go even higher
You can also try 256M if this doesn’t fix the issue, but anything higher is definitely unnecessary unless specifically called for in plugin documentation. If the issue is with the memory limit, the plugin you’re using is almost certainly broken and needs to be disabled.
A side note: Some hosts may enforce an extremely low memory limit and won’t allow you to raise it. If this is the problem, your only option is to switch to a better host or delete the plugin causing the problem.
Upgrade Your PHP Version
Outdated PHP can cause your site to break, and other conflicts are sure to occur. You usually want your site on the latest version of PHP supported by WordPress, which is currently PHP 7.3 to 8.0.
Some WordPress users prefer to stay on PHP 7.4 as they’re concerned about theme and plugin compatibility. Usually, this won’t cause problems. But if you’re using PHP 5.x, it’s imperative you upgrade as it can cause serious conflicts.
A PHP upgrade is a big deal, so make sure you have a backup ready before trying it.
Check for Malware
Sometimes a critical error can be caused by malware, especially if you’re noticing strange PHP scripts that can’t be traced back to your plugins or theme. Removing malware is a tough task, more so when you’re locked out of your website and can’t even run a scan.
It can be hard to tell the difference between legitimate files and suspicious ones added by malware, and deleting random core files isn’t likely to end well. Malware can also modify PHP files, hiding scripts in them you won’t notice as malicious unless you’re a developer.
If you suspect malware is the cause, then it may be best to turn to your web host for help.
When All Else Fails:
If you’ve tried all these options and nothing is working, you definitely have a real problem on your hands. But you can always turn to your web host for help identifying and fixing the issue. A good web host will provide you with the support you need to get your site up and running again.
And in the very end if your hosting doesn’t help you out you can find a support here with us. We will be glad to help you out and fix the issue for your!