WordPressApril 8, 2026

PHP 8.4 and WordPress: What Developers Need to Know

PHP 8.4 shipped with several features that are genuinely useful for WordPress development. Here's what changed, what it means for your codebase, and how to upgrade safely.

Topics covered

  • PHP 8.4 new features
  • Property hooks
  • Array unpacking
  • Upgrading WordPress safely

Why PHP Version Matters for WordPress Developers

PHP 8.4 was released in November 2024, and by mid-2026 it's the version you should be targeting for new WordPress projects. Beyond security — PHP 8.2 reached end of life in December 2026 — each PHP 8.x release brings meaningful performance improvements and language features that make WordPress code cleaner and faster. WordPress core itself has supported PHP 8.4 since version 6.7, and most well-maintained plugins have followed. If you're still running PHP 8.1 or 8.2 on client sites, it's time to plan upgrades.

Property Hooks: The Feature I Wished Existed Years Ago

PHP 8.4 introduced property hooks — the ability to define get and set logic directly on class properties, rather than writing separate getter and setter methods. For WordPress plugin and theme development, this cleans up a lot of boilerplate. Instead of a private property with a public getter method, you can define the transformation or validation logic directly on the property declaration. It's syntactic sugar in the best sense: the intent is immediately readable, and the result is half the code for the same behaviour.

Array Unpacking with String Keys

PHP 8.1 introduced array unpacking for numeric keys; PHP 8.4 extends this to string keys. In WordPress development, where arrays are used everywhere — meta values, query args, plugin options, REST API responses — this is a quality-of-life improvement that adds up over a large codebase. Merging associative arrays via unpacking rather than array_merge is both more readable and marginally faster. It's a small change, but one that makes code involving WordPress option arrays noticeably cleaner.

Deprecations to Watch Out For

PHP 8.4 deprecates implicitly nullable parameter types — a pattern that's common in older WordPress plugins. A function signature like function foo(string $bar = null) now throws a deprecation notice; the correct form is function foo(?string $bar = null). If you're doing any plugin development or maintaining a custom plugin codebase, running PHP_CodeSniffer with a PHP 8.4 ruleset across the project will surface these quickly. Address them before upgrading production — deprecation notices can fill error logs and, in some configurations, cause visible errors.

How to Upgrade Safely

The upgrade path I follow on every client site: first, check plugin and theme compatibility against PHP 8.4 — WP Compatibility Checker plugin handles this quickly. Test on a staging environment with PHP 8.4 enabled before touching production. Review your error logs on staging for any deprecated notices. Run your test suite if you have one. Only then upgrade production. Most managed WordPress hosts make PHP version switching straightforward and allow instant rollback — use that safety net. On a well-maintained site, the upgrade typically takes under an hour.

Written by Manan Vyas

Senior WordPress Developer · Manchester, UK

Get in Touch