How to Fix Critical Errors on WordPress Sites

June 6, 2023 in WordPress Security

Few WordPress problems are as frustrating as the dreaded message: "There has been a critical error on this website." You want to know how to resolve this error as quickly as possible and restore your website — but the critical error message provides little insight into what, exactly, has gone wrong or how it can be resolved.

Fail to promptly and effectively deal with the problems referenced by Google, and you could run into a whole host of issues. Website visitors will quickly be disenchanted as they are unable to access your site and your products or services. This could quickly result in dramatic losses in profits, not to mention long-term damage to your reputation.

What causes the “There Has Been a Critical Error on Your Website” error?

Much of the frustration attributed to the WordPress critical error message stems from its lack of details.

These errors typically involve obstacles to PHP code execution. Perhaps there is an unresolved error with the WordPress theme or plugins — or maybe you've surpassed your memory limit. Either way, you'll need to address the problem swiftly, or you risk suffering these issues:

  • The White Screen of Death (WSoD). Replacing content with a plain white screen, this blank behemoth can stand in the way of your website when incompatibilities or poor coding enter the picture.

  • Internal server errors. As the go-to generic response for unexpected issues, the HTTP 500 internal server error reveals that the server is unable to fulfill a request because it has encountered an unexpected problem.

  • Database connection errors. Another problematic message that can cause untold frustration: "Error establishing a database connection." This means that your site is unable to connect to the required database. This prevents you from accessing not only your site, but also, your admin dashboard.

  • Syntax or parse errors in code. Yet another message can get you scratching your head as you try to restore your WordPress site: "Parse error: syntax error, unexpected." This means that an error exists within the PHP structure. Thankfully, this is typically not all that difficult to fix.

Common WordPress critical errors

It can be difficult to discern what, exactly, is at the crux of any given critical error on WordPress, as the message itself tells you very little. Potential concerns worth looking into include:

  • Issues in the WordPress core files. Corrupted WordPress core files can arise from server-side errors, often experienced while updating databases or configuring directory permissions.

  • Broken theme files or plugin malfunctions. Themes and plugins are often at the heart of critical errors. These may suffer during automatic updates or might not have been compatible in the first place.

  • Syntax errors. Often prompted by incorrect lines within PHP scripts, coding issues can arise in response to missing symbols, misspellings, grammatical mistakes, and a whole host of other issues.

  • Malware infections. When malicious code enters the picture, database information can be changed so thoroughly that your WordPress site can no longer function. Sources could include vulnerable plugins and themes.

  • PHP memory limits. Server limits are a common source of complaint, as these are often surprisingly low. Combine resource-heavy plugins and shared hosting limits, and you have a recipe for disaster.

  • Outdated or incompatible PHP version. New versions of PHP are continually released — and, with these releases comes the discontinuation of support for previous editions. If you're dependent on older versions, you could suffer not only significant website security vulnerabilities but also, this could lead to your site going down at the least opportune time.

Step-by-step troubleshooting

You've encountered the dreaded "critical error" message and need to act fast. How you proceed may determine how quickly your site returns to full functionality — and whether you're able to limit the long-term damage. These troubleshooting essentials should help:

1. Check your admin email inbox for error messages

Often, WordPress error messages include instructions to check your admin email inbox. There, you may find more details about the nature of the error or even its cause. Check for a URL to the recovery mode version of the site.

If you don't immediately see a related email in your inbox, visit the spam folder. Unfortunately, it's possible that you won't receive an email at all and may need to go about fixing the issue on your own.

2. Use WordPress error logs and debug mode

The error_log file can be an invaluable resource in the event of a WordPress error message. This file records several types of PHP errors, including the aforementioned parse. Check whether your hosting provider can help you access the error_log file.

Otherwise, the next best option is to take advantage of the built-in debugging mode. Check the wp-config.php file for lines defining WP_DEBUG, WP_DEBUG_DISPLAY, and WP_DEBUG_LOG as false, but replace the false with true to activate debug mode.

3. Backup your website

Website backups are a must. If your site has recently been backed up, you can easily restore files to the most recent version to get your website running as quickly as possible. The specifics of this process will depend on your unique backup strategy, but the potential for critical errors alone should have you thinking strongly about upping your backup game.

4. Inspect WordPress core files

Issues revealed in the WordPress core will force you to replace missing files. Be prepared to download the relevant version of WordPress and replace specific files. It may also be worth your while to use the command line interface to redownload core files. An FTP client may be helpful if you've lost access to your admin dashboard.

5. Identify conflicting plugins or themes

Take a close look at themes and plugins to determine whether conflicts exist and how they can be resolved. Sometimes, all it takes to get back to the admin area is to deactivate the problematic plugin or even switch themes. Again, this is where an FTP client can come in handy. Default options such as twenty twenty or twenty twenty-one can be helpful for experimentation purposes.

If, while experimenting with disabling plugins or themes, you are suddenly able to access the WordPress admin area, chances are that a malfunctioning plugin or theme is to blame. You may need to reactivate these one at a time to determine which, exactly, is causing your critical error. A vulnerability scanner can provide quick insight and is worth implementing even when you aren't dealing with critical errors.

6. Update PHP memory limits and version

If you're plagued by insufficient memory, simply updating the default limits may help. While the typical limit of 128 MB is more than enough in most cases, exceptions certainly exist. If you've already reached the maximum, it's possible that you need to seek an upgrade for your hosting plan. Look to your web host for a better solution or consider seeking a different provider altogether.

7. Scan for malicious code

Malware may be to blame for your critical error debacle, and, if so, none of the solutions highlighted above will bring you lasting relief. Malware scanning, however, can reveal where the code has been compromised. This will flag suspicious content and provide the insight needed to take additional action.

Scanning your WordPress site is an especially critical step if you've observed other signs of trouble, such as spam search results or warnings from Google Search Console. Implement a daily scanning solution to provide lasting peace of mind.

Best practices for prevention

Following a successful troubleshooting initiative, you will want to enact a variety of preventative strategies that allow you to bypass critical errors in the future. At minimum, implement these best practices:

  • Keep WordPress up to date. Don't fall behind on WordPress updates. These can address a range of security concerns while also boosting general performance. This applies not only to your core files but also to all themes and plugins. Additionally, you'll want to verify that you're running the latest version of PHP.

  • Use staging environments to test new features. Featuring the same content, plugins, and themes, a staging site allows you to run much-needed updates without placing your live site at risk.

  • Develop a disaster recovery plan. In the worst-case scenario, how will you ensure that your WordPress site is up and running as quickly as possible? Create a disaster recovery plan that encompasses swift troubleshooting and reliable backups.

  • Monitor website health and performance. As we've mentioned, daily scanning is crucial for maintaining your site's health and performance over time. Opt for a layered approach that also includes vulnerability detection and a web application firewall.

When in doubt, don't hesitate to get a team of experts in on the action. Professionals have a knack for both spotting WordPress vulnerabilities and fixing them.

Get WordPress website support with SiteLock

Make the most of WordPress opportunities without suffering technical issues: look to SiteLock for help. We provide the full range of WordPress site security services you need to keep your site running optimally.

Check out our plans to learn more about the various services and levels of support we provide. Feel free to get in touch to discuss your needs.

To learn more about WordPress security, see our additional resources:

Image by Mohamed Hassan from Pixabay
Latest Articles
Categories
Archive
Follow SiteLock