Last active
August 29, 2015 14:05
-
-
Save raulillana/4006da7a9daab8b84db4 to your computer and use it in GitHub Desktop.
Notice WP admin when your code is only for PHP 5 or ahead an server is not
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 | |
// if PHP version is lower than version 5 we notice the admin | |
if( version_compare(PHP_VERSION, '5.0.0', '<') ) | |
{ | |
add_action('admin_notices', 'prefix_version_require'); | |
// if user is admin print the notice | |
function purefix_version_require() | |
{ | |
if( current_user_can('manage_options') ) | |
echo '<div class="error"><p>'. __('This WP plugin requires at least PHP 5 to work properly.', 'textdomain') .'</p></div>'; | |
} | |
return; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment