WordPress critical error after a PHP update: how to fix it
Short answer
First find out what kind of PHP update happened: open Tools → Site Health → Info → Server (or ask your host) and compare the version with the one before. A patch in the same series, such as 8.3.35 to 8.3.36 in October 2026’s security release, contains bug and security fixes only and is an unlikely cause. A version change, such as 8.1 to 8.3, is the usual cause: a plugin or theme uses something the new version removed. Switch PHP back to get the site online, find the plugin in WordPress’s email or the error log, fix it, and switch again.
Step 1: what kind of update was it?
| Before → after | What changed | Likely cause of a critical error? |
|---|---|---|
| 8.3.35 → 8.3.36 | Patch: bug and security fixes | Unlikely |
| 8.1.x → 8.3.x | Version: removals and changes | Yes, a plugin or theme |
| 7.4.x → 8.2.x or later | Version: PHP 8.0’s removals included | Very likely, if old plugins remain |
PHP’s release rules for a patch, from one x.y.z to the next: “Bugfixes only (with a room for exceptions on a case by case basis and only for small self contained features additions).” and “Backward compatibility must be kept (internals and userland)” (PHP RFC: Release Process). More on that difference: will a PHP security update break my site?
Step 2: get the site back
- Switch PHP back to the version the site ran before, in your hosting panel (cPanel, Plesk and others). If that version was 8.1 or older, do it only as a short pause: it has no security fixes (why).
- Or pause the plugin: WordPress emails the site administrator about the error, with a link to log in and deactivate the plugin or theme that stopped (WordPress 7.1.2 source).
Step 3: find and fix the cause
The email, or the error log, names the file: the folder after wp-content/plugins/ or wp-content/themes/ is the culprit. Update it, replace it, or send the message to its developer. The common causes, one guide each: create_function(), each(), count() on a value that isn’t a list, non-static methods called statically.
Step 4: check before switching again
The plugin that stopped the site is the first one PHP reached, not necessarily the only one. Check all of them for the version you’re moving to: CompatNav, free on wordpress.org, does it on your own server and reports what will break, with the file and line. Then switch at a quiet time.
The full troubleshooting guide, with recovery mode and reading error messages: “There has been a critical error” after a PHP update.
Key takeaways
- Compare versions: a patch (8.3.35 → 8.3.36) rarely breaks a site; a version change (8.1 → 8.3) can.
- Get the site back first: switch to the previous PHP version, or pause the plugin from WordPress’s email.
- The error message or email names the plugin or theme; that’s where the fix goes.
- A host that moved old versions up during the October 2026 release may have changed more than the patch.
- Before switching again, check every plugin and theme for the new version.
Frequently asked questions
Can the PHP2Shell patch itself break my site?
It’s unlikely: PHP’s release rules allow only bug fixes between patch releases of the same version, with backward compatibility kept. If a site breaks right after a patch, look for another change made at the same time.
My host says it only patched PHP. Why the critical error then?
Ask which version the site ran before and after: a host may also move sites off unsupported versions (8.1 and older) during the same maintenance. Site Health shows the current version.
I can’t switch back. What now?
Use the link in WordPress’s email to log in and pause the plugin that stopped, or ask your host to switch the version back for you.
Check your own site before you upgrade
CompatNav is a free WordPress plugin. It reads the code of your plugins and themes on your own server and tells you, in plain words, what will break and what will only show notices on the PHP version you choose. It never changes your code. It can’t see problems that only appear while code runs with real data, so a quick check of your site after the upgrade still matters.
Sources
- PHP RFC: Release Process
- php.net: Security advisory, 21 October 2026
- WordPress 7.1.2 source: the fatal error handler
About the code examples: each output is the real output of the code shown, run with the official PHP builds, without a php.ini, with all errors reported and displayed. Only the file path was replaced by a neutral server path.