Skip to content

Instantly share code, notes, and snippets.

@maurisrx
Last active August 29, 2015 14:17
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 maurisrx/2530ce3951934510f272 to your computer and use it in GitHub Desktop.
Save maurisrx/2530ce3951934510f272 to your computer and use it in GitHub Desktop.
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