How to Fix the “There Has Been a Critical Error on Your Website”

Dealing with critical errors on any system can be a source of considerable frustration. However, if you’ve recently encountered the “There has been a critical error on your website” message on your WordPress site, there’s no need to panic. These critical errors often stem from conflicts within plugins, theme files, or PHP-related issues. Among the most common challenges WordPress administrators face, these errors can be resolved through various approaches.

In this, we’ll explore the steps you can take to quickly identify and fix the “There has been a critical error on your website” in WordPress, making sure your website is operational again. Also, we’ll go into the reasons behind this error and discuss preventive measures to avoid encountering critical errors in the future.

Image of the "There has been a critical error on this website." error from WordPress.

What is the critical error in WordPress?

The appearance of the “There has been a critical error on your website” message in WordPress indicates the occurrence of a severe PHP error during the execution of code on your site. This occurs when a PHP script halts its operation and cannot finish its designated process.

When you encounter this message, it is advisable to inspect your site admin email inbox for further instructions from WordPress regarding the error.

Essentially, this error signifies a failure in loading WordPress core files or the malfunctioning of additional plugin or theme functionalities. The root causes can range from resource limitations and code-related errors to potential malware infiltration.

Why does the critical WordPress error happen?

The occurrence of critical errors in WordPress can be attributed to various underlying issues. These problems often stem from the following sources:

Issues in the WordPress Core Files

Critical errors may arise when core WordPress files become corrupted or missing. This can happen during unsuccessful website updates or if core files are tampered with unauthorized.

Broken Theme Files or Plugin Malfunction

Corrupted files in WordPress themes or plugins can contribute to website errors. While reputable plugins and themes undergo thorough testing to minimize errors, conflicts between plugins and custom code can lead to critical error messages.

Syntax Errors

Custom code on a website might inadvertently introduce problems, especially if it contains unintentional syntax errors or unsafe characters in paths. It’s essential to review recent modifications in the website environment to identify and rectify syntax errors in the code.

Malware Infections

Certain malware infections can result in critical errors within WordPress. Regularly scanning the website for malware and removing any malicious code is crucial to maintaining a secure environment.

PHP Memory Limits

Critical errors may occur when website owners attempt tasks like media uploads, indicating that PHP has reached its predefined limits while executing a specific script.

Outdated PHP Version

Websites using PHP versions lower than 7.4 may encounter critical errors. It’s imperative to upgrade to a more recent PHP version, especially if still relying on PHP 5. x, to prevent conflicts and ensure compatibility.

Incompatible PHP Version

Some websites utilize old, legacy, or custom code designed for older PHP versions. Upgrading to a newer and more secure PHP version can sometimes cause older websites to break due to compatibility issues.

How to fix the critical error message on WordPress

To identify the root cause of the critical error in WordPress and implement a solution, follow the steps outlined below:

1 – Check your admin email inbox for “Your Site is Experiencing a Technical Issue”

If you have access to the site’s administrative email (set in WordPress > Settings > General), the initial action is to review your inbox.

Expect to find an email from WordPress containing vital details regarding the encountered issue. This particular email notification will bear the subject line “Your Site Is Experiencing a Technical Issue” and will furnish specifics concerning any plugin conflicts or problems identified by WordPress.

Within this email notification, you will discover a convenient hyperlink that facilitates access to your WordPress website in recovery mode, a feature introduced in WordPress 5.2, designed to address the problem:

To enter recovery mode for your website:

  1. Click on the recovery mode link provided in the email.
  2. Log in using your credentials.
  3. Navigate to your WordPress dashboard.

Congratulations! You have successfully activated recovery mode. Here, you’ll find notifications detailing the critical error, its causes, and instructions on rectifying it. Often, this information can aid in pinpointing the conflicting plugin.

Resolve the issue by deactivating the problematic component and attempting to reinstall a clean, updated version of the plugin. Alternatively, consider installing a reputable alternative or reaching out to the plugin developers for assistance. Exiting recovery mode is possible at any time to verify if your WordPress website is functioning normally.

If access to the troubleshooting email is not possible or it fails to provide sufficient information for resolution, the next step involves enabling debugging for your site.

2 – Enable debugging in WordPress

WordPress websites come equipped with a useful diagnostic tool called WP_DEBUG, designed to facilitate the identification of root causes for website errors.

To initiate the troubleshooting process for your website, follow these steps to enable WP_DEBUG:

  1. Access your wp-config.php file: Log in to your hosting account and browse to where your website files are and locate wp-config.php in the main directory of your WordPress installation (usually in File Manager > public_html).
  2. Locate the line that has WP_DEBUG: Navigate to the section in your wp-config file where WP_DEBUG is defined. If it’s currently disabled, the line will resemble this: define('WP_DEBUG', false);

Activate WP_DEBUG: Update your wp-config file with the following code:wp_debug “There Has Been a Critical Error on Your Website”

Enabling the parameter defined ('WP_DEBUG_LOG', true) generates a debug.log file in the ./wp-content directory, providing a resource you can consult at your convenience.

By following these steps, you enhance your ability to identify and address errors on your WordPress website, contributing to a more robust and efficient online presence.

Be sure to set WP_DEBUG to false when you’re done.

3 – Backup your website

Prior to implementing modifications to the core files of your website, it is imperative to create a comprehensive backup. Rectifying critical errors within the WordPress framework can pose complexities, and it is essential to avoid exacerbating any existing issues.

Backing up your website is a safeguard, ensuring that you have a restore point in case unforeseen complications arise during the troubleshooting process. This proactive measure not only preserves your website’s data and configurations but also provides a safety net to revert to in the event that the correction process introduces unexpected challenges.

By prioritizing the creation of a backup, you not only mitigate the risk of data loss but also establish a prudent approach to handling potential complications, fostering a more secure and resilient online environment for your WordPress website.

4 – Check for issues in WordPress core files

Begin by navigating to your website and examining the debug.log file located in the ./wp-content directory for any potential PHP errors. Frequently, these errors will pinpoint issues within the wp-includes or wp-admin files.

For instance, a core file error might manifest as follows:fatal error “There Has Been a Critical Error on Your Website” If such an error is identified, addressing it as soon as possible becomes crucial. To do so, you can start downloading and extracting the core files and then replacing any corrupted versions on your website. You can manually update specific core files or opt for a comprehensive update of the /wp-includes/ or /wp-admin/ folders within your WordPress installation directory.By diligently examining and rectifying issues within the WordPress core files, you contribute to your website’s overall stability and functionality, ensure a seamless user experience, and bolster the security of your online presence.

5 – Check for recently modified theme or plugin files

Conflicts arising from interactions between plugins or themes can trigger critical errors within your WordPress site.

Should you have recently installed or updated a plugin or theme, could you consider temporarily disabling these components through your admin panel to troubleshoot the issue effectively?

Begin by deactivating plugins, allowing you to systematically pinpoint the source of the problem by enabling them one at a time. This method assists in identifying any conflicting elements that may be causing disruptions to your site’s functionality.

However, if your admin panel is inaccessible and you encounter difficulties in modifying your WordPress theme, an alternative approach involves reverting to a default theme directly from your database.

To do this, you must first determine which default WordPress theme is installed. Navigate to your File Manager, then proceed to the wp-content > themes folder. Take note of any default themes present, such as “twentytwenty” or “twentytwentyone.”

With this information in hand, you are prepared to revert your theme effectively, facilitating a smoother troubleshooting process and ensuring the resilience and stability of your WordPress website.

To revert to a default theme in the WordPress database:

  1. Open your database using phpMyAdmin.
  2. In the left menu, navigate to your _options table.
  3. Locate the template and stylesheet rows, typically found on page 2.
  4. Update the option_value for “template” with the default theme installed on your website (e.g., “twentytwenty”).
  5. Press enter to save the changes.
  6. Similarly, update the option_value for “stylesheet” with the default theme.
  7. Press enter again to save the changes.

Subsequently, assess your website to determine whether the theme is the underlying issue. Additionally, consider reinstalling a fresh copy of your original theme to check for resolution.

If the theme isn’t the problem’s cause, investigate your plugins. Begin by renaming the wp-content/plugins directory to plugins-disabled. If this resolves the issue, it indicates that one or more plugins are problematic. Further troubleshooting can be conducted by renaming each individual plugin directory.

If renaming the entire plugins directory does not address the issue, it implies that plugins are not the primary cause. This step-by-step approach aids in identifying and resolving potential issues within your WordPress website, contributing to a more stable and secure online presence.

6 – Increase the PHP memory limit in WordPress

Your web server operates within finite memory, commonly referred to as RAM. WordPress, by default, imposes limitations on the memory usage of each PHP script. When this predefined limit is surpassed, it can lead to critical errors within your website.

If your WordPress debug logs reveal messages like “memory exhausted,” it strongly indicates that PHP’s memory limit is the likely culprit.

To address this issue and prevent critical errors, follow these steps to increase your PHP memory limit:

  1. Open your wp-config.php file.
  2. Scroll to the bottom of the file and specify your desired memory limit: define( 'WP_MEMORY_LIMIT', '128M' );
  3. Save the changes to the file.

After adjusting the PHP memory limit, assess your website to determine if the critical error persists. If needed, consider further increasing the memory limit to 256MB.

Exercise caution when modifying PHP memory limits, as excessively high limits may lead to performance issues or conflicts with hosting provider-imposed constraints.

By proactively managing your PHP memory limits, you enhance the stability and efficiency of your WordPress website, ensuring a smoother online experience for visitors and minimizing the risk of critical errors.

7 – Update PHP to the latest compatible version

Current WordPress versions necessitate a minimum PHP version of 7.4. If you encounter a critical error and are operating on an older PHP version, resolving the issue might be straightforward—upgrade PHP to version 7.4 or a later version.

WordPress provides a helpful chart indicating compatible PHP versions for your specific WordPress version. Verify your PHP version by accessing your WordPress dashboard and then navigating to Tools > Site Health > Info. Within the Server section, expand the details to find information about your PHP version.

Ensuring your PHP version aligns with WordPress requirements enhances your website’s compatibility and functionality, minimizes the likelihood of critical errors, and contributes to a more secure online presence.

8 – Scan for malware

Malware is a common culprit behind critical website errors, particularly when unfamiliar PHP scripts disrupt the site’s environment. It’s crucial to conduct a comprehensive scan at both the web page and server levels to detect signs of compromise, backdoors, and malicious scripts that may be causing issues. Utilize tools lto scan your website for malware, providing insights into potential infections in the external website source code.

However, it’s important to note that not all infections may be outward-facing. Therefore, a server-level scan is also recommended to identify malicious PHP scripts, backdoors, and potential threats like credit card skimmers that may not be evident at the page level. Should the scan reveal any malware, it is imperative to take immediate action to clean up the infection and resolve the critical error. Refer to our hacked WordPress guide for detailed step-by-step instructions, or reach out to our team for assistance in addressing this crucial step in ensuring the security and functionality of your WordPress website.


Critical errors in WordPress can stem from various sources, often originating from conflicts within plugins, theme files, or PHP-related issues. A swift resolution to such problems can be achieved by reverting your website to its last known stable configuration, especially if you have a pre-existing backup.

Consider scanning your website for signs of compromise or malware to pinpoint and isolate the error. This proactive step helps identify potential causes such as syntax errors, malicious PHP scripts, plugin conflicts, or other issues that might disrupt normal PHP execution.

If you have challenges addressing these errors or need expert assistance, Smart Web Ninja is here to help. Our team can provide valuable support in resolving WordPress issues, ensuring your website’s optimal performance and security. Don’t hesitate to reach out for assistance with fixing errors and enhancing the overall health of your WordPress site.