0

I have created sub plugin of woocoomerce.How I can deactivate the subplugin when woocoomerce is deactivate.

1 Answer 1

1

You can use detect_plugin_deactivation,

function detect_plugin_deactivation(  $plugin, $network_activation ) {
    if ($plugin=="parentplugin/parentplugin.php")
    {
        deactivate_plugins(plugin_basename(__FILE__));
    }
}
add_action( 'deactivated_plugin', 'detect_plugin_deactivation', 10, 2 );

Add this snippet in your plugin's main file.

1
  • It's not working
    – pooja
    Apr 16, 2018 at 4:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.