wordpressmultisitewp-cli

WordPress Multisite: Activate / Deactivate a Plugin of a Specific Blog


Programmatically, I want to activate / deactivate a plugin of this specific blog/site in a WordPress Multisite. Any help will be gladly appreciated, thank you!


Solution

    1. From your Network Dashboard go to any subsite dashboard

      enter image description here

    2. Then go to Plugins and activate plugin on this specific blog

    In case you want to do it programmatically you can use activate_plugins() or deactivate_plugins() after a switch_to_blog( $blog_id ) function, example:

    add_action( 'admin_init', 'true_plugin_off_in_theme' );
    
    function true_plugin_off_in_theme() {
        switch_to_blog( 'PASS_BLOG_ID_HERE' );
        deactivate_plugins( 'true-instagram-widget/true-instagram-widget.php' );
        restore_current_blog();
    }