/00-php-version-support.php Secret
Created
March 20, 2018 16:38
Star
You must be signed in to star a gist
[WordPress] Handle PHP Version in WordPress
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
register_activation_hook(__FILE__, __NAMESPACE__ . '\\acme_activate'); | |
/** | |
* Verifies that the user is running the proper version of WordPress for the | |
* plugin to execute; otherwise, displays an error message and prevents the | |
* plugin from being activated. | |
*/ | |
function acme_activate() | |
{ | |
if (version_compare(PHP_VERSION, '5.6.20', '<')) { | |
wp_die( | |
sprintf( | |
'Acme requires PHP 5.6.20 or higher. | |
Your WordPress site is using PHP %s. Please contact your hosting | |
provider and ask that they upgrade the version of PHP on which | |
your installation of WordPress is running. Click back in your | |
browser to your WordPress dashboard.', | |
PHP_VERSION | |
) | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment