Version checks for PHP and WordPress are coming onto the WordPress theme system. The feature was brought to WordPress core on May 18. It will prevent end-users from installing or activating a theme that is incompatible with the current version of PHP or WordPress. The update is scheduled to land in WordPress 5.5.

This feature has long been on the wish lists of many theme authors, particularly the checking of versions of PHP. Authors of plugins gained the ability to support different versions of PHP from WordPress 5.2 onward. Nonetheless, theme authors have been left feeling like second-class citizens. They are normal when it comes to adding core functionality. Waiting patiently as plugin authors awaited the fresh and innovative resources they looked forward to.

The code used to perform version checks manually within individual themes was previously more complex than in plugins. Theme authors required two separate methods, depending on the user’s WordPress version, to run compatibility checks after theme switch and block theme previews in the customizer. This means writers of the theme covered all of their bases.

Users had no clear way of knowing whether a theme was going to work on their site until they installed it and tried enabling it. This was bad user experience, even though the end-user failed gracefully with a theme.

This user experience has also discouraged some theme authors from moving to newer PHP versions. Many have been supporting PHP 5.2 for years. Little by little, some of these same authors are now moving towards new features up to PHP 5.6, which is the minimum that WordPress supports now. Not many did make the jump to PHP 7 and newer though.

Until now, there’s no method to let the user know they need to update their PHP to use a different theme.

With a potentially broader user base some theme writers can opt to continue supporting older versions of PHP, such as 5.6. Developers who want to migrate to newer apps, however, can now do so with core platform support.

Changes for Users

PHP and WordPress Version Checks Coming to WordPress Theme System

Users browsing the WordPress theme directory can start finding new details for certain themes. As with plugins, visitors will see a version of WordPress and a version of PHP listed for certain themes. For starters, the theme Twenty Twenty now lists the following minimum requirements:

WordPress Version: 4.7 or higher
PHP Version: 5.2.4 or higher

Not all the themes will still have those numbers listed. It will take some time to update older themes with the data needed to fill in those fields.

The admin interface for themes will change with WordPress 5.5. WordPress will prevent such actions when it attempts to install or activate a theme. If a user searches for a theme with a WordPress or PHP version that is incompatible, the normal installation button will be replaced with a disabled “Cannot Install” button. If a theme is installed but not activated, the activation link will be replaced with a disabled “Cannot Activate” button. Users will not be allowed to see incompatible themes live preview, either.

Cannot Activate the Theme

The feature works exactly the same from within the customizer interface as it does through the WordPress admin themes screen.

Changes for Theme Authors

he WordPress Themes Team recently announced two new headers required to place theme authors in their style.css files. The first required field is Tested, which is the latest version of WordPress against which the theme was tested. The second is a PHP field Requires, which is the minimum version of PHP that the theme supports.

The reason the team chose to include these two fields is unknown, but not the Requires at least field, which is the minimum version that WordPress requires. The theme authors will most likely want to put all three headers into their themes.

Theme authors that will still support WordPress versions earlier than 5.5 will want to continue to use their old compatibility checks. This is however the first step in phasing out such code.

You may also like:

8 Best Live Chat Plugins for WordPress

20 Amazing WordPress Plugins for Bloggers for 2020