Table of Contents
Table of Contents
WordPress may sometimes show you a message that ‘There has been a critical error on your website. WordPress is essentially alerting you of a fatal problem on your website with this message. During this period, the site will remain inaccessible to visitors, and you may be blocked from accessing the admin panel.
When WordPress has a major problem, it stops loading all of the scripts that are necessary for it to work properly.
The critical error in WordPress can usually be traced back to an issue with PHP: either your memory limit being surpassed, or an error in your code, plugins, or theme. Database corruption is another potential issue.
Since all of the best WordPress plugins have undergone extensive testing, it is less likely that they would result in a serious problem when used alone. The issue could be caused by a clash with another WordPress plugin or by some custom code.
Below are methods of resolving critical errors in your WordPress site.
1. Enable Debug in WordPress
Facing trouble with WordPress, enable debugging as an initial procedure. With debug mode on, you’ll be able to see the various PHP errors occurring on your site, and you can use this to trace back to the root of the issue.
Use these procedures, if you need to manually activate debugging or view the debug log.
Here’s what it will look like when done.
define( ‘WP_DEBUG’, true );
define( ‘WP_DEBUG_DISPLAY’, false );
define( ‘WP_DEBUG_LOG’, true );
Now that your site has been debugged, the log will show any issues. The debug log, called debug.log, is located in the wp-content folder.
Inspect for references to a certain file or the names of your theme or plugins that will indicate their involvement.
When you’re finished debugging, make sure to revert these lines of code.
2. Deactivate Your Site Plugins
Plugins are frequently the cause of major errors. It could seem impossible to find the problematic plugin if your website has dozens or even hundreds of them.
You can find the problematic plugin by is to disable them all or one by one. If so, turn them on one by one until your website malfunctions once more.
And there’s the culprit!
You can deactivate a plugin from the Plugins area in your WordPress admin panel. But, in a situation where you’re blocked from accessing the back-end, you’ll have to deactivate the plugins manually.
You can find all the plugins used in your site by navigating to wp-content > plugins from your WordPress site’s root directory.
3. Restore Your Website From the Most Recent Backup Copy
The mere possibility of your WordPress site suffering a critical error is a good enough reason for you to regularly back up your site. Restoring a recent backup may be all you need to do to get your website working again in the shortest time possible.
The method used to create the backup determines how to restore it.
4. Clear Your Site Cache
By temporarily storing crucial and frequently used data, caching makes your website load faster. Nevertheless, the cache may get corrupted as data builds up. When this happens, you’ll get a critical error on your site.
This problem can be resolved by clearing the cache. After all of the outdated data is removed, your website ought to function properly once more.
5. Raise the Max Upload File Size and Text Processing Functions
A minor adjustment to a few PHP functions may be sufficient to resolve the critical issue if it appears occasionally and not on every page.
While increasing the recursion and backtrack limits can prevent some huge pages breaking, uploading large files and seeing an error screen is likely the consequence of the maximum upload file size being too small.
Check your upload size limit first, then compare it to the file you are attempting to upload.
Set the new maximum upload size in ini_set() as indicated below after opening the wp-config.php file in a text editor to raise the limit:
ini_set(‘upload_max_size’ , ‘256M’ );
ini_set(‘post_max_size’,’256M’);
We also raise the text processing maximum size on the line above.
6. Upgrade Your PHP Version
Using an old version of PHP is a common cause of critical errors in a WordPress site. For this reason, you should always use the latest stable version of PHP for your WordPress site.
Errors are unlikely to occur in stable versions like older versions (PHP 5.x).You also don’t have to worry much about plugin and theme compatibility.
In this post, we examined a number of methods for resolving this issue and restoring your website.
To briefly recap, they are as follows.