You’ve got to actually check is_plugin_active
. I would use something more like this, shamelessly stolen and modified from here:
register_activation_hook( __FILE__, 'dependentplugin_activate' );
function dependentplugin_activate()
{
require_once( ABSPATH . '/wp-admin/includes/plugin.php' );
if ( is_plugin_active( 'nextgen-gallery/nggallery.php' ) )
{
require_once ( WP_PLUGIN_DIR . '/nextgen-gallery/nggallery.php' );
}
else
{
// deactivate dependent plugin
deactivate_plugins( __FILE__);
// throw new Exception('Requires another plugin!');
// exit();
exit ('Requires another plugin!');
}
}
Edit: just realize you’re looking for deactivate, not activate. Still, maybe this will get your brain working in the right direction.
Related Posts:
- OOP: Display warning and deactivate the plugin if PHP version is less than 5.4
- Uninstall, Activate, Deactivate a plugin: typical features & how-to
- When can you get current page ID and initialize hooks right after?
- Customizing subject in comment notification e-mails
- How to save the values of checkbox to the register setting?
- Edit plugin without hooks in functions.php
- Using the ‘draft_to_publish’ hook (post status transition)
- Enqueue style inside shortcode but its loaded at the bottom of page (before footer scripts)
- Good tools for locating hooks in a wordpress page/admin interface/blog post?
- disable active plugins for specific theme
- Pass A Value From Outside To A Plugin Variable
- Built in admin ajax hooks?
- Failed to invoke other hook from the init hook
- How can I add a custom meta value on file upload?
- Adding dynamic section to WordPress
- How can I filter blog name?
- Fatal error: Class not found in
- Is it possible to add an action to the currently running action?
- Showing Notifications While Activating Plugin
- Determine plugin name from within plugin_action_links filter
- How to prevent action in ajax request, when in admin side?
- merging an array to an existing array using add_filter
- template_redirect not being called when using ajax
- Placement of Code in Plugin for hooking `save_post`
- publish_post plugin hook doesn’t always pass $post->post_content
- Do you clean up your self-written plugins’ at deactivation?
- What are the benefit in adding hook in the init() hook?
- add_action in functions.php, do_action in plugin?
- How to correctly detect accessing wp-content/uploads?
- How to automate wordpress plugin activate and deactivate by php logic?
- add action for displaying posts using a shortcode
- Deactivate Plugin on Theme Switch
- ‘wp_login’ action hook not working with wp-login.php file
- Remove rewrite rules generated by plugin during deactivation
- Why my Plugin keeps deactivating automatically?
- How to pull code snippet from functionality plugin?
- Prevent a plugin from being automatically activated
- Where (or when) should I register a new taxonomy?
- Any hook for pre-plugin-update -either bulk or single plugin update
- How to get all of the activate_plugin action parameters?
- How to stop activating a plugin and show admin notice when dependent plugins minimum version is not met
- Using a post-signup hook to get user details
- Get Time Taken By Each Action Hook in WordPress
- Are functions in main plugin file called before function bound to register_activation_hook runs?
- do_action() hook into load-(page)
- Howto check version of another plugin and then add a submenu page to it
- Hook for page Request?
- How do I add $_SESSION[”] to my wordpress page?
- Save user total active time after login in wordpress [closed]
- wp_loaded with static Singleton
- is it possible to hook every page style?
- Quick press publish post hook
- using wp_footer hook in a plugin
- My plugin does not install correctly if a previous version is still installed
- How to automatically activate users after registration without activation email?
- Creating a plugin that will display text on every page
- Activation flow of a plugin in a multisite environment
- Add hook after content without formatting
- admin_post hook not firing function inside class
- The function called on the wp head hook becomes null
- When/where would want to attach other classes to the base class in a WordPress plugin?
- Passing function into add_action always returns the first argument
- Hook to display element as product on category page
- WordPress Boilerplate Plugin doesn’t see callback functions for add_settings_field and add_settings_section
- plugin not hooking to my custom hook
- Plugin hook breaks new WP 4.0 media library grid view?
- Plugin Hook: Get posts
- Display_rows() and column_cb() strange behaviour
- How to create and use Custom hooks
- Checking url from plugin [duplicate]
- Is it possible to run javascript on plugin deactivated?
- How wordpress plugin hooks works? [duplicate]
- Post curl function save twice using plugin hook function wordpress
- WordPress Hooks : Where to place callbacks that repetitively yield the same effect?
- Suitable hook when creating, updating and deleting posts programmatically
- Why is my activator class adding the files/running the actions I add?
- is_user_logged_in() undefined at shutdown in plugin context
- Schedule WordPress Auto-Updates to only run during business hours
- Where can I find a schema of wordpress plugin core architecture?
- Admin-ajax.php is dying “0” without processing function
- How do I register a stylesheet inside a WordPress widget?
- Woocommerce Shipping module available only for type of products [closed]
- How to remove an Ajax action
- WordPress Plugin Boilerplate – add_action hook in static “activate” function
- Has anyone used require.js for handling plugin scripts?
- Multiple files in a plugin
- adding a new value to a serialized array in WP_option table
- Randomize attachment IDs
- Call to a member function have_posts() on a non-object on normal loop
- Not able to add option in Sub-Menu under page
- Calculate price and display on woocommerce product single page under price (simple price, variable price) [closed]
- jQuery for custom plugin not working with Divi theme
- Plugin Activation Error – The plugin generated 22 characters of unexpected output during activation
- Custom Plugin: How to Include Install Buttons of other 3rd Party Plugins?
- Modify Plugin PHP Class in Child Theme – Correct Method
- Hook on widget context plugin to add custom context for widget
- mailjet plugin – extend functionnalities and reuse api
- Creating fields in the database
- contact form 7 captcha support anyother captcha plugin? [closed]
- plugin doesn’t retrieve data from database