Bright Labs

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.

A few PHP 8.5 deprecations from the PHP manual, and what to look for
Deprecated in PHP 8.5What 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 coloncase 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.

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.

Sources

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