Reputation: 1164
Is there a way to prevent WordPress from activating a plugin, when I click "Activate", and PHP or WP have the wrong versions?
Upvotes: 0
Views: 850
Reputation: 325
<?php
register_activation_hook( __FILE__, 'bh_proljece_boj_install' );
function bh_proljece_boj_install()
{
if ( version_compare( get_bloginfo( 'version' ), '3.3', ' < ' ) )
{
deactivate_plugins( basename( __FILE__ ) ); // Deactivate our plugin
}
}
?>
Upvotes: 1
Reputation: 1083
There is a global variable $wp_version
or you could use get_bloginfo('version')
to get the WordPress version. You could also use the version_compare(...)
PHP function for PHP version comparison where both verifications could be evaluated in your plugin activation function.
Upvotes: -1