-
-
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"
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
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