Skip to content

Instantly share code, notes, and snippets.

@raulillana
Last active August 29, 2015 14:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save raulillana/4006da7a9daab8b84db4 to your computer and use it in GitHub Desktop.
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
<?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