We’re excited to announce PHP 8.2 availability on WordPress.com!

In fact, it was actually available yesterday, but you know how much developers like writing blog posts…

Notable Changes in PHP 8.2

For WordPress developers, deprecated dynamic properties is probably the most significant change in PHP 8.2.

Historically, when writing a property that hasn’t been declared, PHP silently creates a dynamic property instead. Objects can be a useful place to store data, so use of dynamic properties is quite common in WordPress plugins and themes. However, this behavior is deprecated in PHP 8.2, and will be removed in PHP 9.

// Given a Post class with one declared property...
class Post {
    public $post_title;
$post = new Post;

// Assigning declared property Post::$post_title is fine.
$post->post_title = 'PHP 8.2 Is Available On WordPress.com';
// Assigning an undeclared property is changing.
$post->post_status = 'publish';
// PHP <= 8.1: Silently creates dynamic $post->post_status property.
// PHP 8.2: Raises deprecation warning, still creates dynamic property.
// PHP 9.0: Throws Error exception.

Two other notable deprecations in PHP 8.2 include:

Check out the RFCs for the full breadth of changes in PHP 8.2, including readonly classes and constants in traits.

If you haven’t upgraded from PHP 7.4 just yet, one of the most notable features in PHP 8 is the addition of JIT (Just-in-Time) compilation. This allows PHP to compile code at runtime, rather than before execution, resulting in faster performance and reduced memory usage. This can greatly improve the speed of WordPress sites, especially those with complex plugins and themes.

Use PHP 8.2 on WordPress.com

PHP version selection is available to all WordPress.com Business and Ecommerce sites with hosting features activated.

We strongly encourage you to test any new PHP version in another environment before changing it on your live site. If you’re comfortable with the command line, the PHPCompatibility for PHP CodeSniffer is a helpful tool for identifying some code that needs to change (it doesn’t quite find everything, yet).

To switch the PHP version for your site:

  1. Visit the Settings → Hosting Configuration section of your site’s dashboard. 
  2. In the Web Server Settings section, you can see the version of PHP your site is currently running.
  3. Click the drop-down to change the version your site runs.
  4. An Update PHP Version button will appear. Click the button to confirm your changes.

Learn more about switching PHP versions on WordPress.com in our support portal, or let us know your favorite PHP 8.2 feature in the comments.

2 thoughts on “PHP 8.2 is Now Available on WordPress.com

  1. Please note that the “PHPCompatibility for PHP CodeSniffer” library/package is not an acceptable one to use for PHP 8+ compatibility checking. The official release has no PHP 8+ checks in it and you would have to use the “dev” release to only get maybe half of the PHP 8 issues detected. It seems as though the larger WordPress community has been oblivious to that fact and has incorrectly assumed that their plugins/themes/etc are PHP 8 compatible based on using that library when in fact they are far from compatible.

    * https://github.com/PHPCompatibility/PHPCompatibility/issues/809
    * https://github.com/PHPCompatibility/PHPCompatibility/issues/1299
    * https://github.com/PHPCompatibility/PHPCompatibility/issues/1348

Comments are closed.