WordPress Critical Error After a PHP Update: How to Recover and Fix It

WordPress Critical Error After a PHP Update: How to Recover and Fix It

Did WordPress break immediately after a PHP update? This guide explains how to restore the site, find the real error in the logs, identify the incompatible plugin, theme, custom code, or server setting, and complete the upgrade safely.

Kseniia BeliaevaKseniia Beliaeva

You changed the PHP version, refreshed the website, and WordPress replaced the page with a critical error message. The dashboard may be unavailable too. It looks dramatic, but the timing gives you a useful clue: something in the WordPress installation or server environment is not compatible with the new PHP runtime.The fastest way to make the site respond again is often to switch temporarily to the previous PHP version. That restores availability; it does not solve the compatibility problem. The proper fix comes from reading the error, identifying the responsible plugin, theme, custom code, dependency, extension, or configuration, and testing the correction before attempting the upgrade again.This guide explains how to recover access, collect useful evidence, diagnose the failure, and complete the PHP update without turning production into a guessing game.

The short answer

If WordPress shows a critical error immediately after a PHP update, temporarily restore the previous PHP version if you need to bring the site back online. Then check the WordPress Recovery Mode email, PHP error log, hosting logs, or wp-content/debug.log to find the first relevant fatal error.The file path and message usually point to a plugin, theme, custom snippet, must-use plugin, dependency, missing PHP extension, or changed server setting. Fix, update, replace, or reconfigure that component on staging, test the important site flows, and only then switch production to the newer PHP version again.

Before touching anything else, preserve the evidence

A critical error becomes harder to diagnose after several unrelated changes. Before updating every plugin, clearing every cache, and renaming half of wp-content, record what happened.

  • Write down the previous and new PHP versions.Save the exact error message and affected URL.Note whether the frontend, wp-admin, REST API, cron, or only one page fails.Record the time of the PHP switch, including the timezone.Download or preserve the relevant PHP and web-server logs.Check whether any plugin, theme, WordPress, hosting, or configuration update happened at the same time.Confirm that a usable backup exists before modifying files or the database.

If the website processes orders, memberships, donations, bookings, or form submissions, also record whether background jobs and incoming data are still running. A homepage that loads does not prove the entire application is healthy.

Stop making simultaneous changes

Updating WordPress core, every plugin, the active theme, PHP, the database, and caching configuration in one session removes your ability to isolate the cause. If possible, change one layer at a time and verify the result before continuing.If several updates already happened, do not assume PHP is the only cause simply because the error appeared after the version switch. Use logs and controlled tests to separate correlation from the actual failure.

Restore availability without calling it fixed

For a live business website, the first priority is often restoring a stable public version while the compatibility problem is investigated elsewhere.

Temporarily switch back to the previous PHP version

If your hosting control panel allows it, switch the site back to the exact PHP version it used before the failure. Clear the relevant server or page cache, then verify the frontend and critical functions.This rollback can buy time, but it is not a permanent solution—especially when the old PHP branch no longer receives security support. The incompatible code still exists, and the next forced hosting update will expose it again.If the host no longer offers the previous runtime, ask whether it can restore the earlier environment temporarily or create a staging copy using the failing PHP version. Do not upload a random PHP build or change server packages without understanding how the hosting stack is managed.

Verify more than the homepage

After rollback, check:

  • the homepage and a normal content page;WordPress admin access;forms and email notifications;search and filtered content;scheduled actions and cron-dependent features;REST API or webhook endpoints;login, membership, or account pages;WooCommerce product, cart, checkout, payment, and order emails.

Rollback restores the old runtime, but caches, queued jobs, and partial updates may leave separate problems behind.

Try WordPress Recovery Mode

WordPress includes a built-in Recovery Mode for some fatal PHP errors. When it activates, WordPress sends a message to the site administrator email address with details and a special login link.Inside that Recovery Mode session, the failing plugin or theme can be paused for the administrator so the dashboard loads. Look for notices naming the component and error. This is useful for regaining access and collecting information; pausing the component is still not the same as making it compatible.

If the Recovery Mode email never arrives

Check the administrator address, spam folder, and mail delivery logs if available. The email may fail because the site cannot load far enough to initialize its mail plugin, or because the server's direct mail is filtered.Recovery Mode also does not cover every failure. Errors in cron, background requests, very early bootstrap code, must-use plugins, server configuration, or the PHP startup process may require direct log and filesystem access.

Find the first useful error

The public message “There has been a critical error on this website” intentionally hides technical details. The useful information is in a log.

Check the hosting and PHP logs first

Many hosts expose PHP, application, and web-server logs in their control panel. Search around the exact time and URL of the failure. If you contact support, provide the timestamp, timezone, domain, affected path, old PHP version, and new PHP version. “The site is broken” gives them much less to work with.Start with the earliest fatal error produced by the failing request. Later messages may be consequences of the first failure or noise created while WordPress attempts recovery.

Enable WordPress logging carefully

If server logs are unavailable or incomplete, WordPress can write errors to a debug log. Add or update these constants in wp-config.php before the line that says WordPress has finished loading configuration:

define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );
@ini_set( 'display_errors', 0 );

Reproduce the error once, then check wp-content/debug.log. The official WordPress debugging documentation recommends using these tools in development or staging rather than leaving debug mode active on a public site.Do not set WP_DEBUG_DISPLAY to true on production. Error output can reveal filesystem paths, code details, queries, or other information visitors should not see. Logs can also contain sensitive data, so restrict access, download only what is needed, and remove or protect public log files after diagnosis.

Reproduce the same request

If only one action fails, opening the homepage may not write the relevant error. Reproduce the exact route:

  • submit the affected form;open the failing editor screen;run the import or export;trigger the scheduled action on staging;request the affected REST endpoint;add the relevant product variation to the cart;repeat the checkout step using a safe test method.

The most useful log entry is the one connected to the action that actually fails.

How to read common PHP errors

You do not need to understand every line in a stack trace before taking the next step. First identify the error type, message, file path, and line number.

Log messageWhat it usually meansWhat to inspectUncaught TypeErrorCode passed or returned a value PHP no longer acceptsThe named function or method, plugin or theme version, and PHP migration notesCall to undefined functionA removed function, missing dependency, or unavailable PHP extensionThe function name, originating file, installed extensions, and code ageClass not found or Interface not foundA dependency did not load, autoloading failed, or an update is incompleteComposer/vendor files, plugin dependencies, load order, and deployment completenessParse error or syntax errorThe file contains syntax unsupported by that runtime or a damaged/manual editThe exact file and line, deployment history, and source-controlled versionAllowed memory size exhaustedThe request exceeded the configured PHP memory limitNew PHP configuration, loops, imports, queries, media processing, and plugin behaviourRequired PHP extension ... is missingThe new runtime was built or configured without a needed extensionHosting PHP modules and requirements of WordPress, the plugin, or integrationDeprecatedThe code uses behaviour scheduled for removal or discouraged by the current runtimeThe owning component and its update path; prioritize repeated and business-critical pathsWarning or NoticeThe request may continue, but the code has a problem or assumption worth reviewingWhether warnings are being displayed, repeated heavily, or masking a separate fatal

The file path is often your strongest clue

A path under wp-content/plugins/plugin-name/ points toward that plugin. A path under the active parent or child theme points toward theme code. A path in wp-content/mu-plugins/ identifies must-use code that will not appear among normal active plugins.A WordPress core file appearing at the final line does not automatically mean core is defective. A plugin or theme may have passed invalid data into a core function. Read the message and stack trace far enough to find where the bad call originated.

Not every deprecation caused the outage

A log can contain hundreds of deprecation notices followed by one fatal error. The deprecations are technical debt and should be addressed, but the fatal is what stopped the request.Do not solve the incident by hiding every message. Separate immediate failure, compatibility work, and lower-priority cleanup into different tasks.

Identify the component that fails

If the log names a plugin, theme, or custom file clearly, begin there. If it does not, isolate components systematically on staging.

Disable one suspected plugin safely

When the dashboard works in Recovery Mode, deactivate the named plugin there. If wp-admin is unavailable, rename only that plugin's directory using SFTP or the hosting file manager. Keep the original folder name documented so it can be restored after the code is replaced or tested.With WP-CLI access, a specific normal plugin can be deactivated with:

wp plugin deactivate plugin-slug

WP-CLI also supports skipping normal plugins during diagnosis, but must-use plugins still load. Run commands only when you know the correct WordPress path, site in a multisite network, and effect on production traffic.

Use plugin isolation as a test, not the final fix

If the log is unclear, disable normal plugins on staging and restore them in controlled groups until the error returns. This narrows the source without randomly deleting files.Be careful with ecommerce, membership, multilingual, security, caching, and integration plugins. Deactivation can change scheduled jobs, rewrite rules, data handling, or public functionality. A staging copy is the correct place for broad isolation.

Test the active theme carefully

Switching temporarily to a current default WordPress theme on staging helps determine whether the fatal belongs to the active theme or child theme. Do not rename the only active theme on production unless a working fallback theme is installed and you understand what the switch will do to templates, widgets, menus, and frontend behaviour.

Remember code outside normal plugins and themes

The failure may live in:

  • a snippets plugin or code injected through the database;a must-use plugin in wp-content/mu-plugins;a hosting-specific integration;advanced-cache.php, object-cache.php, or another WordPress drop-in;a custom Composer dependency inside a plugin or theme;an incomplete deployment or missing vendor directory;an auto-prepended PHP file configured by the server;a PHP extension or runtime setting that changed with the selected version.

If every normal plugin is disabled and the error remains, do not keep repeating the same test. Move outward to the theme, must-use code, drop-ins, server configuration, and deployment.

Common reasons WordPress breaks after a PHP updateAn abandoned plugin or theme uses removed behaviour

Old code may rely on functions, signatures, type handling, or language behaviour that changed in newer PHP releases. An available update may solve the problem. If the component has been abandoned, replacing it is usually safer than maintaining an unsupported dependency indefinitely.Replacement can require more than installing a similar plugin. The old component may store data in its own format, provide shortcodes, control theme templates, or expose functions called directly by custom code. Map those dependencies before removing it.

Custom code was never tested on the target PHP version

A child theme, custom plugin, integration, or small “temporary” snippet can contain the only incompatible line on the site. Fix the code in a maintained source, add a regression test where practical, and deploy it properly.Avoid editing a commercial plugin or parent theme directly. The next update can overwrite the patch, leaving the same failure waiting for you again.

A bundled library or Composer dependency is outdated

The top-level plugin may look current while a bundled library is not. Errors involving namespaces, autoloaders, polyfills, or files inside vendor need dependency-level investigation.Do not run an uncontrolled Composer update inside production. Updating a dependency can change APIs used by the surrounding plugin. Rebuild and test the complete package.

The new PHP runtime has different extensions or configuration

Switching versions can select a different php.ini, extension set, memory limit, upload limit, timezone, or PHP-FPM pool. A missing extension may break image processing, archives, internationalization, remote requests, database access, or a specific integration.Compare the old and new environments rather than assuming the language version is the only difference. WordPress publishes current server environment and PHP extension recommendations, while individual plugins may have additional requirements.

The request now exhausts a lower memory limit

An “allowed memory size exhausted” fatal is not automatically a PHP compatibility bug. The new runtime may use a different memory limit, or the failing request may already have been close to the boundary.Increasing the limit may restore the request, but investigate why it needs that memory. Imports, recursive hooks, inefficient queries, image processing, large exports, and plugin conflicts can consume increasing resources until another limit is reached.

Cached bytecode or generated files are stale

After a PHP switch or deployment, server opcode cache, page cache, object cache, generated CSS, and CDN content may not all represent the same release. Clear only the relevant layers and restart PHP workers when the hosting setup requires it.Cache clearing should follow a code or configuration correction. Repeatedly purging caches without changing the cause is not diagnosis.

Choose the right permanent fix

Once the source is confirmed, choose the correction based on ownership and future maintenance.

CauseReasonable permanent responseMaintained plugin or theme has a compatible releaseUpdate it on staging, review its changelog and migrations, then run regression testsAbandoned componentReplace it and migrate its data, templates, shortcodes, and dependent custom codeCustom plugin, theme, or snippetPatch the maintained source, review nearby compatibility issues, and add testsOutdated bundled dependencyUpdate the full package or dependency set through its build process and retest integrationsMissing PHP extensionEnable the correct extension or adjust the implementation with the host or server ownerChanged runtime configurationAlign required settings deliberately; do not copy the entire old configuration without reviewMemory exhaustionFind the expensive request, correct inefficient behaviour, and set an appropriate monitored limitStale generated files or opcode cachePurge or regenerate the correct layer after deploying the actual fix

Do not “fix” the site by suppressing the error

Hiding warnings from visitors is correct production configuration. Hiding a fatal from yourself, suppressing it with @, or lowering error reporting until the log looks quiet is not a compatibility fix.The request must complete correctly, return the expected data, and pass the relevant functional tests. Silence is not the same as health.

Test more than the page that crashed

PHP compatibility failures do not always appear during an ordinary page view. Code may run only for administrators, scheduled jobs, API requests, specific products, logged-in users, or rare form conditions.

Run static checks and runtime tests

A static compatibility scan can find known syntax and API problems in custom code, but it cannot prove that the website works. Runtime tests exercise the actual WordPress installation, configuration, database, plugins, theme, and integrations together.Use both where the codebase justifies it:

  • scan maintained custom code against the target PHP version;run existing automated tests;load representative frontend and admin pages;test authentication and user roles;submit forms and verify stored entries and notifications;exercise imports, exports, cron, queues, and webhooks;test the REST API and integrations;complete a safe WooCommerce test order and refund path where relevant;review logs for new fatals, warnings, and repeated deprecations.

For the full preparation workflow, see How to Safely Upgrade PHP on a WordPress Site Without Breaking Production.

Test logged-out behaviour separately

Administrators may bypass full-page cache or receive different scripts, permissions, and templates. Always verify the public site in a clean browser session as well as the authenticated dashboard.

Attempt the production upgrade again

Once staging passes, prepare a controlled production change.

  1. Confirm that production matches the tested code, database changes, plugin versions, theme versions, and relevant server configuration.Create a fresh backup and confirm the rollback method.Choose a lower-traffic deployment window appropriate for the site's audience.Pause or account for imports, queues, orders, form submissions, and content edits that could diverge during the change.Deploy the compatibility fixes before or together with the PHP switch in the tested order.Clear or regenerate only the caches and generated files required by the deployment.Run the smoke-test checklist immediately.Monitor PHP logs, application logs, uptime, transactions, forms, scheduled actions, and external integrations.

Keep the rollback threshold explicit. For example, a fatal checkout, missing form entries, repeated background-job failures, or an unexplained spike in PHP errors may justify restoring the previous known-good state while the issue is investigated.

What not to do after a PHP-related critical error

  • Do not leave detailed errors visible to visitors. Log them privately instead.Do not stay indefinitely on an unsupported PHP version. A rollback is breathing room, not a maintenance strategy.Do not update every component at once on production. You will lose the causal trail and may introduce unrelated migrations.Do not delete the plugin folder named in a log. Preserve the files and data while you determine the correct update, patch, or replacement.Do not edit vendor plugins or parent themes without a maintainable patch path. An update can erase the fix.Do not increase memory repeatedly without investigating consumption. A loop or runaway query can grow into the new limit.Do not assume a green homepage means the upgrade succeeded. Test background jobs, admin workflows, forms, APIs, and transactions.Do not ignore logs after deployment. Some errors appear only under real traffic or scheduled execution.

WordPress critical error recovery checklist

  • Record the old and new PHP versions.Save the exact error, URL, timestamp, and timezone.Confirm that a restorable backup exists.Temporarily restore the previous PHP version if production availability requires it.Test the site beyond the homepage after rollback.Check the WordPress Recovery Mode email.Read the hosting, PHP, and web-server logs.Enable private WordPress logging on staging if more evidence is needed.Find the first relevant fatal error and its file path.Identify whether it belongs to a plugin, theme, custom code, must-use plugin, drop-in, dependency, extension, or server setting.Reproduce the failure on staging using the target PHP version.Update, replace, patch, or reconfigure the responsible component.Run static checks on maintained custom code where useful.Test frontend, admin, forms, cron, APIs, integrations, and transactions.Review the logs again after the fix.Prepare a fresh production backup and rollback plan.Deploy the tested changes in a controlled window.Monitor production after the PHP switch.Disable temporary debug settings and protect or remove diagnostic logs.

Recover first, then remove the reason it happened

A PHP rollback can turn an outage into a manageable maintenance task. The error log turns that task from guessing into diagnosis. The permanent solution is the part that matters: removing or correcting the incompatible dependency, verifying the full website, and completing the upgrade on a supported runtime.The critical error screen is frustrating, but it is also specific evidence that the code and runtime disagree. Preserve that evidence, trace it carefully, and fix the component that actually failed. No plugin roulette required.

Frequently asked questions

Did a PHP update take your WordPress site down?

I can trace the fatal error, identify whether it comes from a plugin, theme, custom code, dependency, or server configuration, and implement a fix that survives the next deployment. You will know what failed, what changed, and what still needs attention—without a trail of mystery edits across production.

No polished brief required. Replies within one business day.

How to Safely Upgrade PHP on a WordPress Site Without Breaking Production

Read post

WooCommerce Database Optimization for Large Sites

Comprehensive Guide to Optimizing WordPress Security: Tips and Best Practices