Support » Fixing WordPress » deactivate_plugins How to use it?

  • I’m trying to deactivate a plugin by code when a particular condition is meet. I tried this code:

    register_activation_hook( __FILE__, 'gp_register_activation_hook' );
    function gp_register_activation_hook () {
        deactivate_plugins( __FILE__ );

    but it doesn’t work.
    This function works if I call gp_register_activaction_hook by admin_init hook but I would like to check only when I activate the plugin. Anyone use this function with success?

  • The topic ‘deactivate_plugins How to use it?’ is closed to new replies.