PHP compatibility in WordPress

Last Revised: October 2, 2021

If WordPress has an important point it is that of PHP, and this is what is being promoted the most lately (if not almost always). And this is why many of the internal projects that are being developed around WordPress such as Project Tide or Servehappy.

Hide the version

Without a doubt, the first thing we have to do is hide the PHP version so that it is not public from the requests of the web server. To do this, we must configure the file [php.ini] so that the display line of the version does not appear.

expose_php = Off

Hide errors

In the same way that we hide the PHP version, we must also make sure that we do not show possible execution errors of the PHP itself. This can generate the “white screen of death” because if something fails, we will not be able to see anything and if we need it, the tools that WordPress itself brings to debug must be activated.

display_errors = Off

PHP Compatibility

Whether you are a developer or just a user, you have to be on top of which version of PHP to use. That is why it is highly recommended to use version 7.0 as a minimum version, although version 7.2 as a recommended version. From here, how do you know if the plugins or templates you have are compatible with the recommended versions? Well, for this it is best to use the WP Compatibility Checker plugin.

With this plugin you will get in summary form if the plugins are compatible, and if they are not, what should be improved or changed. By installing it you will be able to choose which version to analyze and its results.


In addition, a very interesting detail is that you can do this analysis of all plugins / templates or only the assets via WP-CLI.

wp phpcompat {version} [--scan={scan}]
{version} PHP version to test.
[--scan={scan}] Whether to scan only active plugins and themes or all of them. default: active options: - active - all

Integration with Plugins

In recent times WordPress has added a field that indicates the minimum version of PHP necessary for some elements (for example, plugins) to work.

=== Plugin Name ===
Contributors: (this should be a list of userid’s)
Donate link:
Tags: comments, spam
Requires at least: 4.6
Tested up to: 4.8
Requires PHP: 5.6
Stable tag: 4.3
License: GPLv2 or later
License URI:

Seguir con Seguridad para WordPress

About this document

This document is regulated by the EUPL v1.2 license, published in WP SysAdmin and created by Javier Casares. Please, if you use this content in your website, your presentation or any material you distribute, remember to mention this site or its author, and having to put the material you create under EUPL license.