Skip to content

Instantly share code, notes, and snippets.

@maurisrx
Last active Aug 29, 2015
Embed
What would you like to do?
1st snippet in post "How to Check Whether Other WordPress Plugin is Active or Not"
function prfx_check_EDD() {
// Check if core EDD plugin is not active
if ( ! class_exists( 'Easy_Digital_Downloads') ) {
// Check if plugin active
if ( is_plugin_active( plugin_basename( __FILE__ ) ) ) {
// Deactivate plugin
deactivate_plugins( plugin_basename( __FILE__ ) );
// Unset activation notice
unset( $_GET[ 'activate' ] );
// Add error notice on admin screen
add_action( 'admin_notices', 'prfx_admin_notice' );
}
}
}
add_action( 'admin_init', 'prfx_check_EDD' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment