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


You can use detect_plugin_deactivation,

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

Add this snippet in your plugin's main file.

| improve this answer | |
  • 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.