0

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

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.

  • It's not working – pooja Apr 16 '18 at 4:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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