You've just updated something on your WordPress site when something goes horribly wrong. The error message displays, "The site is experiencing technical difficulties".
We can all agree that this WordPress error is really frustrating.
Vague alerts that give little indication as to what is causing the problem can be hard to fix.
In this context, we shall look into how to fix this WordPress error.
Introduction of a fatal error protection feature in WordPress 5.2 displays an error message stating:
The site is experiencing technical difficulties.
This error message can appear in two ways:
"The site is experiencing technical difficulties."
This error, however, occurs only for public pages.
"The site is experiencing technical difficulties. Please check your site admin email inbox for instructions."
On the other hand, this happens when we try to go to a page in the WordPress admin panel.
In newer WordPress versions, the variation of this error reads:
"There has been a critical error on your website".
This appears on the front end of the site.
"There has been a critical error on your website. Please check your site admin email inbox for instructions".
An this appears on the backend.
WordPress will then sends an email to the admin email address.
It contains a link to access the backend and attempt to fix the error.
If we do not have access to the admin email or cannot get WordPress emails, it is difficult to find out the error.
Mostly, it is simply a generic error. It does not imply that the site is deleted or completely broken.
If there is an invalid PHP code, WordPress 5.2 and above will show this error.
A likely culprit is either a theme or a plugin update, or perhaps even a core WordPress update.
We may also come across this error in the process of an automatic update. It will show until the update is complete.
To begin, we can ensure that our WordPress admin email address is correct and we receive notification emails.
1. Debug mode
With Debug mode, WordPress will display any PHP errors it encounters whenever we try to access the site.
In addition, we can set it to produce a log file to look at while preventing the error from being shown publicly.
Initially, we need to find the wp-config.php file. It will be in the root WordPress directory.
With cPanel, to do this, we can go through File Manager, or we can FTP into the server directly.
i. To create a private log file, we need to add the following code. We can add it anywhere above /* That's all, stop editing! Happy blogging. */:
define( ‘WP_DEBUG_DISPLAY’, false );
ii. Once done, hit save and then refresh a page on the site.
iii. Then we go to the /wp-content/ folder in File Manager or FTP to see the file log.
What we are searching for is a line reading 'PHP Fatal Error:'.
PHP Fatal error: Cannot redeclarebp_members_screen_display_profile() (previously declared in /…/buddypress/bp-members/screens/profile.php:22) in /…/buddypress/bp-members/screens/profile.php on line 32
This shows the path along with the file name and name of the plugin causing the issue.
Hence, we will know whether the problem was a plugin, theme, or WordPress core issue. Once we know, we can delete those and the site will be back in action.
Then, we inform the creator of the theme or plugin regarding the problem to fix the bug. Before proceeding with the troubleshooting, ensure to back up the site files first.
Once done, take out the code lines we added to the wp-config.php file and save.
2. Fix theme conflicts
To check this, initially, we need to find the theme in File Manager or FTP program:
i. Click wp-content and then find the theme.
ii. Rename the active theme. Then we check if wp-admin starts working again. If it does, the issue was with the theme.
iii. In such a case, inform the author about the bug. They can help us solve.
iv. If nothing changes, we change the theme back to its original name. The problem was not caused by our theme.
3. Fix plugin conflicts
i. If we fail to get into the WordPress admin section, we access the public_html directory with File Manager or FTP.
ii. Navigate to wp-content, then plugins, and rename the plugins folder.
iii. Afterward, if the site reloads, the problem was one of the plugins.
iv. If so, we can change the name of the plugins folder back.
v. Now, change each plugin name to another and back one at a time to see which causes the problem.
vi. Once found, delete the culprit.
4. Upgrade version of PHP
The issue can also be because we have not switched to the newest PHP.
Recently, one of our customers came across a PHP fatal error because the version was not supported by WordPress anymore.
Make note that any version of PHP less than 5.6 does not work anymore.
Even if we run PHP 5.6, we might encounter the error.
So, to avoid it in the future, our Support Techs advise updating PHP to 7+.