WordPress theme system now has PHP and WordPress version checks. The change is slated to land in WordPress 5.5.
The feature of PHP and WordPress version checks was pulled into core WordPress. It will prevent end-users from installing or activating a theme that is incompatible with their current version of PHP or WordPress. Now, plugins authors have the support of specific PHP versions starting with WordPress 5.2. Previously, they had to check the code manually. It was more complex than in plugins.
Changes for user and theme authors
According to the announcement, in WordPress 5.5, the admin interface for themes will change. When attempting to install or activate a theme, WordPress will prevent such actions. If a user searches for a theme that has an incompatible WordPress or PHP version, the normal installation button will be replaced with a disabled button that reads “Cannot Install.” If a theme is installed but not activated, the activation link will similarly be replaced with a disabled “Cannot Activate” button. Users will also not be allowed to live preview incompatible themes.
Visitors should see a WordPress Version and PHP Version listed for some themes. It is needed to note that it will take some time to see such lists for all themes. The WordPress Themes Team recently announced that the Tested up to and Requires PHP fields were required to be added in the style.css header. Tested up to is the version of WordPress that the theme has been tested against. This should be numbers only, so ‘5.0’ and not ‘WP 5.0’. Requires PHP field states the lowest version of PHP that the theme can utilize. If empty, it will default to whatever the oldest version of PHP that WordPress supports.