Skip to content

Instantly share code, notes, and snippets.

@markbiek
Created December 9, 2019 13:53
Show Gist options
  • Save markbiek/d0c631ac43e98546aa1bd3f6c28d70c7 to your computer and use it in GitHub Desktop.
Save markbiek/d0c631ac43e98546aa1bd3f6c28d70c7 to your computer and use it in GitHub Desktop.
Check for a specific PHP version from a WordPress plugin
//Load the current WP core version
include( ABSPATH . WPINC . '/version.php' );
if (version_compare($wp_version, '5.3') < 0) {
//If WP core is < 5.3, do a PHP version check ourselves
$php_version = phpversion();
if (version_compare($php_version, '7.1') < 0) {
die('This plugin requires PHP 7.1 or higher');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment