7 Proven Ways to Fix a Critical Error in WordPress
Seeing the message “There has been a critical error on your website” can be alarming for any WordPress site owner. It may block user access and sometimes even prevent you from entering the admin panel.
The good news is that most of the time, this problem can be fixed quickly. In this article, we’ll go through 7 practical methods to resolve this error.
1. Check Your Error Logs
Start by inspecting the error_log file, which contains PHP error details. You can access it via your hosting account’s File Manager or an FTP client. Usually, it’s located at:
home/[username]/.logs/error_log_[yourdomain]
This file records different types of PHP errors: warnings, notices, parse errors, and fatal errors. Look for parse or fatal errors, as these usually cause the site to crash and need to be fixed first.
2. Enable WordPress Debug Mode
WordPress has a built-in debugging feature to detect code issues in the core, themes, or plugins.
To activate it, edit the wp-config.php file in your public_html folder and look for these lines:
define( 'WP_DEBUG', false );
define( 'WP_DEBUG_DISPLAY', false );
define( 'WP_DEBUG_LOG', false );
define( 'SCRIPT_DEBUG', false );
Change all false values to true to turn on debugging. This will help you identify the exact cause of the error.
3. Resolve Theme or Plugin Conflicts
If you can access the admin panel, try switching to a default theme like Twenty Twenty.
If you cannot access the admin area, use File Manager or an FTP client:
- Go to
public_html → wp-content → themes. - Rename your active theme folder to something like
youractivetheme-disabled. - Reload your site.
- If the site works, the issue is with your theme. Consider rolling back or changing it.
- If the problem persists, check your plugins by temporarily renaming the
pluginsfolder.
4. Restore From a Backup
Restoring your site from a backup is often the quickest solution if something broke recently.
- If using hPanel, go to
Files → Backupsand select a backup version. Restore thepublic_htmlfolder and then the database. - If using a plugin like UpdraftPlus, follow the recovery instructions from the email WordPress sends when the critical error occurs.
5. Update Your PHP Version
WordPress requires PHP 7.4 or higher. An outdated PHP version can trigger critical errors.
- In hPanel, go to
Advanced → PHP Configuration. - Check your current PHP version. If it’s below 7.4, upgrade to 7.4 or 8.0 and save changes.
6. Re-upload WordPress Core Files
Corrupted or missing WordPress core files can also cause critical errors.
- From the WordPress admin, go to
Dashboard → Updatesand click Re-install version x.x.x. - If you cannot access the admin, download WordPress from the official site and upload it via FTP, excluding the wp-content folder to preserve your themes and plugins.
7. Increase PHP Memory Limit
WordPress sets the default PHP memory limit to 128 MB. Insufficient memory may trigger a critical error.
- In hPanel, go to
PHP Configuration → PHP Options → memoryLimitand increase it. - Alternatively, you can update the
wp-config.phpfile:
define('WP_MEMORY_LIMIT', '256M');
Final Thoughts
Don’t panic if you see the “There has been a critical error on your website” message. Check your email for the WordPress notification, and use the above steps to troubleshoot. With a little patience, most issues can be resolved quickly without losing your content.