1

I would like use a plugin only on my network home site. Here is the converse of my question: wordpress.stackexchange.com

There is the solution this:

add_filter('site_option_active_sitewide_plugins', 'modify_sitewide_plugins');

function modify_sitewide_plugins($value) {
    global $current_blog;

    if( $current_blog->blog_id == 2 ) {
        unset($value['akismet/akismet.php']);
    }

    return $value;
}

How to modify this code, that the $value plugin should be disabled on every subsites (automatically also on subsequent sites), expect on the $current_blog?

1 Answer 1

0

So the code is for one site, and you want it to be for all except one. You need to change the == part to != in order to do this. This way instead of running the code inside the if on the site with ID 2, it will run on all sites except the one with ID 2.

But I don't know why you would do this, since you can activate a plugin only on one site by just activating it from its dashboard (you do not need to network activate it).

1
  • Than I asked this question I thought this is the best way to the solution, but easier exchange the user (avatar scr, username links) references in admin-bar.php (and the comments.php in current theme directory). Commented Jan 17, 2018 at 4:46

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.