For those who’re reading this, it’s too late.
(No, I’m kidding. That’s a Drake mixtape from 2015.)
For those who’re reading this, you’ve probably just tried to go to your WordPress website and were greeted with a menacing message.
“There was a critical error on this website.”
Gulp.
But it surely’s okay. We are able to fix it.
The 1st step: Don’t panic.
What you might have encountered is the “critical error message.”
(Or, the artist formerly referred to as the White Screen of Death, AKA the WSoD.)
That is one in all the commonest WordPress errors, and while that moniker sounds intimidating, the fact isn’t as terrifying as you may imagine.
For a few years, WordPress sites experiencing this issue would simply be greeted with a blank, all-white screen.
(It wasn’t very helpful.)
But, since WordPress version 5.2, there’s an error message that lets when things have gone incorrect and offers you an idea of how one can fix the problem.
On this guide, we’ll dig deeper into the the explanation why the critical error message occurs and how one can take care of it when it does.
Let’s party!
What Is A WordPress Critical Error?
The fabled critical error or WSoD can occur when certain things go incorrect with WordPress.
Normally, you’ll see the above message (or, in some cases, the plain white screen) when attempting to access your site’s frontend. In some cases, you’ll see the identical result when attempting to access the WordPress admin panel (“wp-admin”), making the error especially scary for somebody experiencing it for the primary time.
Don’t worry, though — Your site continues to be there. You only must resolve the error to bring it back to life.
Before we get to that, what causes the critical error to occur in the primary place?
The issue often stems from a problem with your site’s PHP, which is the programming language WordPress relies on.
The error will likely be triggered due to:
- Faulty code added to your website
- Conflicts between plugins
- PHP version issues/memory limitations
We’re going to assist you work out which issue is causing your case and the way you may fix it. You’ll probably learn so much about WordPress along the way in which, too.
Restoring From A Backup
The quickest and easiest technique to resolve the critical error issue is to easily revert your website to a previous version.
Normally, the issue was attributable to a change made to WordPress.
As an illustration, for those who recently installed a brand new plugin, added some code to your site, or made edits to your site’s theme files.
Before we dive into how one can fix those problems, consider restoring a backup copy of your website.
Many WordPress hosting providers offer managed backup services.
If that’s the case, then all you must do is log into your hosting account and find where the backups are stored. Search for a backup that was created before the error began to occur.
Sometimes this may occasionally not be an option — Possibly your web host doesn’t provide backups, or perhaps you’ve recently made loads of changes to your site or added loads of content that you simply don’t wish to lose.
If that’s the case, then we’ll must dig in to resolve the problem one other way.
(It’s price noting that for those who do restore an earlier version of your site, you’ll likely lose all changes made to your site between now and when the backup was created. That features latest posts or pages, uploaded image files, and some other updates you made during that point.)
Get Content Delivered Straight to Your Inbox
Subscribe to our blog and receive great content identical to this delivered straight to your inbox.
Quick Fixes For The Critical Error Problem
Let’s start with a couple of easy fixes first.
Read The Email From WordPress (If Applicable)
Best case scenario: Once this error is triggered in your site, chances are you’ll receive an email from WordPress sent to the admin email address.
The error you see will say something like:
For those who check your email, you need to receive a notification concerning the error and a few details about troubleshooting.
Follow the instructions from the e-mail and see if that resolves the problem.
In some cases, you’ll see just the plain white screen or receive an error message without mentioning an incoming email.
If that’s the case, try the subsequent few steps to resolve the issue one other way.
Try Using Recovery Mode
In some cases, the e-mail you receive from WordPress will prompt you to initiate a special feature called Recovery Mode.
This can allow you to regain access to your WP admin panel to troubleshoot errors, but importantly, this can not fix the issue. As a substitute, it’ll just grant you access to the WP admin panel to disable plugins or fix any code errors without resorting to FTP/SFTP access.
Even for those who didn’t receive an email with instructions or the instructions didn’t work, you may still try using Recovery Mode manually.
To log into your site via Recovery Mode, just visit this URL:
yoursite.com/wp-login.php?motion=entered_recovery_mode
From there, you’ll be prompted with a WordPress login screen where you may enter your username and password.
Jump in and revert any changes, roll back your themes, plugins, or whatever else could have caused the problem.
Revert The Last Thing You Did On Your Website
Adding a line of code or pasting in a PHP script from the web could break your site.
For those who were recently tinkering together with your WordPress site immediately before the problem occurred, the simplest option is perhaps to remove or revert that website change manually.
For those who can access the WP admin panel:
Log into your WordPress backend and take a look at removing or reverting the change that you simply recently made.
As an illustration, for those who added some code from a web based tutorial, try deleting that code out of your theme files and see if it fixes the problem.
For those who recently installed or updated a plugin, try deactivating that plugin.
Plugins are probably the most common perpetrator behind the WSoD error, so for those who made changes to at least one recently, your first motion needs to be to deactivate it. For those who reload your site and every little thing is back to normal, you’ve found the source of your problem! It is best to then contact the plugin’s developer or log a ticket in its support forum for further assistance.
For those who’re unsure which plugin is perhaps the issue, you may deactivate all of your plugins at the identical time by going to the Plugins screen in your WordPress dashboard and using the Deactivate option within the Bulk Actions dropdown menu.
For those who cannot access the WP admin area:
You’ll must make these changes by accessing your site’s web server via SFTP/FTP client or using your host’s file manager.
When you get access to your site, navigate to the most important WordPress directory. (Normally named “wordpress” or something like “home,” “html,” or “www.”)
Find the wp-content folder.
From there, you’ll must make the changes directly within the relevant file.
As an illustration, say you modified your site’s theme file, which resulted in an error.
Navigate to wp-content > themes > your-theme-name. Then, find the relevant file you edited (e.g., “header.php”). Open the file.
You may edit it using a desktop text editor like Notepad or an IDE like Sublime Text. Remove the code that you simply added and save the file.
One other situation could also be that you simply installed a brand new plugin, which caused the error.
In that case, navigate to the /wp_content/plugins folder.
Find the folder of the relevant plugin. Now, rename the folder to anything apart from its current name. E.g., change the name from “simple-plugin” to “simple-plugin.renamed.”
This can deactivate the plugin and will fix the problem.
Change Your Theme
Just as plugins can contain outdated or incorrect code, so can themes. Some themes might be improperly coded or cause a conflict with a number of of your plugins. There could have also been an issue with installing or updating the theme that has left it incomplete. Finally, for those who’ve made changes to the theme’s functions.php file, that may also cause an error.
Fortunately, checking to see in case your theme is causing the WSoD is straightforward. All you must do is to disable it and revert to a generic theme as a substitute.
If you might have access to the admin dashboard:
Go to Appearance > Themes. Hover over one in all the default WordPress themes, akin to Twenty Twenty-Three, and click on Activate.
If the admin dashboard is just not available, you may also do that using SFTP/FTP or File Manager.
Open the /wp_content/themes folder and easily rename the folder for the theme you’re currently using. (E.g., change the folder name from “current-theme” to “current-theme_test.”)
This can cause WordPress to deactivate your theme, and robotically apply the default theme as a substitute. You may now check your site to see if the fatal error is gone.
If this method fixes the issue, that your theme was the explanation for the error. If you might have recently made changes to the theme, you need to try removing those changes or deleting the theme and reinstalling the unique version. If this doesn’t fix the issue, you’ll wish to consult with the theme’s official documentation or reach out to the developer for more assistance.
Enable Debug Mode To Diagnose The Problem
If you might have come this far without finding the answer to your woes otherwise you’ve diagnosed the issue but still need a technique to actually fix it, well, it’s time to stop playing nice.
Meet: WordPress debug mode.
This can be a tool built into all installations of WordPress. Normally, that is turned off since it’s strictly intended for testing purposes, but you may activate it at any time.
Activating the debug mode lets you create an error log of every little thing that happens when your site tries to load. You may even decide to display this information directly on the page.
It’s really helpful that you simply do that on a testing or staging version of your site, as the data gathered by the debug mode might be sensitive. For instance, it could contain personal information or highlight security flaws.
To activate the debug mode, you’ll must edit your site’s wp-config.php file. This file is a hugely necessary constructing block in your site, because it incorporates all of your database information (including your passwords). It is best to, subsequently, consult with the official documentation before you begin editing it.
Whenever you’re ready to start out debugging, access your site through SFTP, SSH, or your host’s file manager. (See Option 2 for more details.)
Navigate to the basis directory of your WordPress installation. (This needs to be the folder that incorporates folders like “wp-content.”)
Search for the wp-config.php file.
Open it up and search for the next line within the file’s code:
define( 'WP_DEBUG', false );
This code sets the debug mode to “false” or off.
Replace this line with the next two lines:
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
(For those who don’t see anything that appears like the unique line within the wp-config, you may insert the 2 lines anywhere within the file before the ultimate line, which should read, “/* That’s all, stop editing! Pleased blogging. */.”)
Whenever you save the file, the debug mode will likely be activated. This may also enable the WP debug log, which generates a debug.log file within the /wp-content/ directory. This error log file might be opened and skim using most traditional text editors, akin to TextEdit or Notepad.
Nerd note: You could possibly also decide to display the error messages directly on the page. To do that, add the next code to wp-config.php: define( ‘WP_DEBUG_DISPLAY’, true );
Now, try visiting your website again.
Then open the log file in /wp-content/ directory.
It is best to see some details concerning the PHP error that occurred.
(Heads up: Remember to disable debug mode and debug logging after you’ve solved your issue. Take into account that the debug log can sometimes expose vulnerabilities and other issues together with your site.)
With this info in hand, we’ll jump in to solving the issue.
Fixing The Issue
For those who’ve followed along this far within the article, then presumably you’ve hit the part where you’re now the log file and pondering, “what the heck does this mean?”
Let’s get this thing fixed once and for all.
Deleting Or Fixing Theme Code
Some of the common problems that triggers the critical error message is that you simply simply have broken or malformed code somewhere in your site’s theme files.
For instance, chances are you’ll see an error like this one:
Parse error: syntax error, unexpected $end in /home/name/public_html/wordpress/wp-content/themes/your_theme/functions.php on line 231
On this case, you may see that the issue lies within the functions.php file, specifically on line number 231. This tells us exactly where to look with the intention to fix the issue.
You may now open up the functions file, check the noted line, and investigate to see what could have caused the syntax error. Normally, it’s something easy, like a missing semicolon or a typo.
For those who get error messages which are less straightforward, you may generally enter them into Google or one other search engine to search out more information. You’ll rarely encounter a singular problem, so any person is at all times prone to have faced — and solved — your specific issue before. As such, you may often consult with the WordPress Codex and support forums for assistance.
Not comfortable or aware of PHP, and this whole thing looks like a foreign language to you? Consider reaching out to your hosting provider’s technical support.
Share the error with them and see in the event that they can assist you address the problem.
As soon as you might have corrected the issue, you may save the file after which check your site again.
Disable Plugins
Even for those who haven’t installed a plugin recently, it may well still cause an error.
Many sites are set to update plugins robotically, and a brand new update to either the plugin or your WordPress installation could create the error.
How will you tell if that is so and determine which plugin is responsible?
Referring to your error code, you need to see evidence that a plugin is causing the problem.
You may see an error like this:
Parse error: syntax error, unexpected $end in /home/name/public_html/wordpress/wp-content/plugins/your_plugin/plugin.php on line 231
You may tell that it is a plugin-related error because the placement of the error is a file inside the /wp-content/plugins folder.
For those who’re a savvy PHP coder, you may address the problem (as discussed in the primary section.)
If not, you’ll probably just wish to disable the plugin until an answer is found.
To do this, navigate to the /wp-content/plugins/your_plugin folder. Rename the folder to anything but its current name (e.g., “your_plugin_disabled”).
This can disable the plugin causing the error and restore your site whilst you work out how one can fix the issue that’s creating the error.
If this doesn’t fix the problem as expected, otherwise you’re having trouble, consider temporarily disabling all of your plugins.
Do that by simply renaming the complete “plugins” folder to something latest like “plugins_test.”
This won’t be a long-term solution, however it is a vital a part of troubleshooting.
If this fixes the problem, you may create a brand new folder called “plugins” after which move the plugin folders into it individually to see which plugin causes the positioning to interrupt.
Related: Learn how to Create Your First WordPress Plugin (With a Minimal Amount of Coding)
Increase Your Memory Limit
If the WSoD only appears occasionally or on certain parts of your site, it could be because your site has exceeded its maximum memory limit. This refers specifically to the PHP memory limit, which is the quantity of memory allocated to the PHP that WordPress runs on. You should use the site health info screen to search out details concerning the configuration of your WordPress site. The limit will often be set to 40MB by default, but sometimes that’s not enough.
To repair this, you must assign more memory to your installation. The precise technique to do this may occasionally vary depending in your specific setup and host, but let’s cover a number of the commonest methods.
To extend your site’s PHP memory:
- Access your site via SFTP/FTP, File Manager, or SSH
- Navigate to the WordPress root folder
- Open wp-config.php
All you must do is add the next line anywhere within the file before the closing line:
define( 'WP_MEMORY_LIMIT', '128M' );
The number + “M” is the quantity of MB (megabytes) you should allocate to the PHP memory.
Nonetheless, you may only increase the memory limit by a lot. Your site and installation may have a set maximum which you can’t exceed, so at a certain point you just cannot keep bumping up the limit. If this happens and you discover that increasing the memory limit doesn’t fix the issue, you may want to contemplate upgrading your current hosting plan. It’s possible that your site has outgrown the hosting environment and also you’ll need to contemplate upgrading to a unique hosting plan.
Check Unusual Errors
If you might have made it this far and still haven’t been capable of resolve your WSoD, you might have our sympathies. You’re also within the minority, because the techniques we’ve covered thus far will resolve the overwhelming majority of errors. Nonetheless, there continues to be hope!
We’re now going to quickly run through a number of the more unusual issues that could cause problems with WordPress (leading to the WSoD). These are less prone to be the cause but should not unheard of, in order that they’re necessary things to envision for those who’ve tried every little thing else already.
See If Your Server Is Down
It’s possible that your site’s issues could stem out of your host server experiencing problems. The server could possibly be down completely, so check other sites that are hosted on the identical server. It’s also possible that there’s a server error or the server is just not functioning appropriately. It could even be down for maintenance.
A technique you may check that is to review your host’s service status:
Even in case your server appears to be advantageous and the host is just not experiencing issues, you need to still try to contact their support. Your site should still be experiencing troubles consequently of the server, even when no person else is having the identical problem. Due to this fact, they might give you the option to assist you.
Check Your Caching Solution
Implementing a caching solution in WordPress is a superb way of speeding up your site. Nonetheless, since it saves old versions of files, there’s a risk that outdated content could cause problems.
This might be fixed by purging the cache, which is able to clear all that unnecessary stored data out of your site. Whenever you’ve done that, check your site again to see for those who’ve fixed the issue. If that’s the case, chances are you’ll wish to contact the developers behind your caching solution to search out out why the WSoD happened, or get in contact together with your host’s support team.
Related: Optimizing Your Website for Speed Tutorial
Investigate Your Site For Corrupted Files
It’s rare that WordPress core files get corrupted, but it may well occur.
For instance, an error could occur when a new edition of WordPress is installed, causing a number of of the files to be incomplete. When that is the case, you’ll often see something within the error log created by the debug mode – but not at all times. For those who suspect that there’s a problem together with your site’s core files, you’ll wish to contact your host and ask them to assist you diagnose and fix the issue.
What To Do If Nothing Fixes The Critical Error
Within the unlikely event that the critical error stays after you’ve performed the entire above troubleshooting techniques, it’s time to employ some last-resort solutions.
Nonetheless, before you do the rest, you need to first contact your host’s support team for those who haven’t done so yet. In lots of cases, they’ll give you the option to assist you out.
One final possible problem could possibly be that the version of PHP running in your server is outdated and now not supported by WordPress. This happens every every so often for those who don’t keep your hosting environment up to this point as latest WordPress versions will sometimes require newer PHP in place. (As of the time of writing this, WordPress requires PHP 7.4 or later.)
If that doesn’t work or your hosting support can’t provide assistance, then you might have to reinstall WordPress altogether.
Sometimes in case your site was hacked or malware was by some means added to your site, it may well be very difficult to remove the issue without starting fresh.
But for those who follow our instructions on how one can get better a hacked site, you need to give you the option to reinstall WordPress and reconnect it to your existing database without losing all your files and content.
Is It Fixed?
Hopefully this guide helped you fix your website 20 minutes ago and also you didn’t even make it this far into the article.
But bless your heart for those who’re still reading anyway.
Take into account that while lots of these fixes can seem easy, they’ll quickly turn into much greater problems for those who’re unsure what you’re doing.
So don’t be afraid to ask for help.
In any case, that’s what we’re here for.