Is WordPress compatible with PHP 8.5? What core supports and what to check in your plugins
Your host now offers PHP 8.5, and you want to know if your WordPress site will survive the switch. On the core side, support for PHP 8.5 was labelled beta when WordPress 6.9 shipped. Your plugins and theme are the part to check before you switch.
Below: what the core team actually says, a few PHP 8.5 deprecations worth searching for, a check you can run before switching, and what to do if something breaks anyway.
What the WordPress core team says about PHP 8.5
PHP 8.5 was released on November 20th. The core team's announcement says that when WordPress 6.9 shipped on December 2nd, support for PHP 8.5 and 8.4 would be labelled as beta support. Compared to previous PHP releases, relatively few changes were required, mostly to address new deprecations and warnings.
The same post says PHP versions 8.3 back to 7.2 are fully supported. Support for older versions stays at PHP 7.2.24 and higher.
So why "beta"? The core handbook explains that WordPress is rarely used in isolation (without any theme or plugins). A new PHP version kept the beta label until at least 10% of all WordPress sites ran that version or later. The handbook now says that label has been retired.
In short: on WordPress 6.9 or later, put your testing time into the plugins and theme you added on top of core.
PHP 8.5 deprecations worth searching for
These four entries from the PHP manual's list of PHP 8.5 deprecations are worth searching for in older plugin and theme code.
| Deprecated in PHP 8.5 | What to look for in old code |
|---|---|
| The backtick operator as an alias for shell_exec() | Shell commands written between backticks |
| Ending a case statement with a semicolon instead of a colon | case lines inside a switch that end in ; where you'd expect : |
| Using null as an array offset, or passing it to array_key_exists() | Array lookups where the key variable can be null |
| The cast names (boolean), (integer), (double) and (binary) | Old-style casts like (integer) or (boolean) |
The catch: check every plugin and theme, including the ones you installed years ago and never opened. Treat every deprecation notice you find as a line to fix, or a reason to ask the plugin's author for an update.
How to check your site before you switch to PHP 8.5
Work through this list in order, before you switch.
- Find your versions. Open Tools > Site Health > Info. The WordPress section shows the WordPress version you're running, and the Server section covers your server setup, including various PHP variables. If you're on a WordPress version older than 6.9, update WordPress first.
- Update plugins and themes. Get everything onto its current release before you test.
- Scan the code against PHP 8.5. Search your plugin and theme files for the patterns in the table above, and note each file and line you find.
- Test on a staging copy. Switch the staging copy to PHP 8.5 and click through the pages that matter: checkout, forms, logins, anything a plugin builds. Turn on error logging there, not on the live site. The WordPress docs warn that with WP_DEBUG_LOG on, errors are written to a file that is potentially available to all users.
- Switch the live site, then check again. After your host moves the live site, open Site Health again and look over the same pages you tested on staging.
We make a free plugin for the scanning step: Bright Labs Compatibility Scanner for PHP, on WordPress.org. It reads the code of every installed plugin and theme and lists each file and line that uses something removed or deprecated in the PHP version you pick, from 8.2 to 8.5. It runs inside WordPress in short steps and needs no exec() or shell access, so it works on hosts that switch those off. One honest limit: it reads code without running it. It can miss problems in code built at runtime and flag code that never runs, so a clean scan is a good sign, not a reason to skip staging.
What happens if you stay on an older PHP version
Staying where you are has risks too. Per php.net, each PHP release branch is fully supported for two years from its first stable release. After that it gets two more years of fixes for critical security issues only. Once those four years are up, the branch reaches end of life and is no longer supported.
PHP's own wording on end of life is blunt: users should upgrade as soon as possible, as they may be exposed to unpatched security vulnerabilities. WordPress points the same way. Site Health has a critical issue that reads "Your site is running an outdated version of PHP, which requires an update". The core team also encourages all users to run the latest versions of PHP, including PHP 8.5.
So staying put isn't a safe default either. Upgrading after you've tested is the calmer option.
If something breaks after the switch
First work out whether it's core or a plugin. Go to the error log on your staging copy and note the file path in the message. If the path is inside a plugin or theme folder, start with that plugin or theme.
- If it's a plugin or theme: check for an update first. If there's none, send the author the exact error text with its file and line.
- If you need the site working right now: switch the PHP version back, if your host lets you, and fix things on staging without the pressure.
Sources
- WordPress core handbook: PHP compatibility and WordPress versions
- Core team announcement of PHP 8.5 support in WordPress 6.9
- PHP manual list of features deprecated in PHP 8.5
- PHP supported versions and support policy
- PHP end of life dates for unsupported branches
- WordPress documentation for the Site Health screen
Questions
Should I switch my live site to PHP 8.5 right away?
Only after you've checked it. WordPress 6.9 shipped with beta support for PHP 8.5, so your plugins and theme are what to check. Update them, scan them, test on a staging copy, and switch the live site once staging runs cleanly.
Why was PHP 8.5 support labelled beta?
The core handbook points out that WordPress is rarely used without any theme or plugins. A new PHP version kept the beta support label until at least 10% of WordPress sites ran it. The core handbook says this label has now been retired.
Does a clean scan mean my site will work on PHP 8.5?
No. Our scanner reads code without running it, so it can miss problems in code built at runtime and can flag code that never runs. Treat a clean result as a good sign, and test on a staging copy before you switch.
Related
- "Creation of dynamic property is deprecated" in WordPress: what it means and how to fix it
- How to check if your WordPress plugins and themes will work on a newer PHP version
- Which plugin is causing the PHP deprecated warnings in your WordPress log? How to find it
- PHP 8.2 end of life: what it means for your WordPress site and what to do before it