• Resolved fid

    (@fid)


    I want to activate this on my multisite setup but have it enabled on all sites excepts id=1 (the main site). How can I do this? Any code changes? Thanks.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Janis Elsts

    (@whiteshadow)

    That will indeed require code changes. Here’s something that might work: open /includes/menu-editor-core.php and find the load_custom_menu method. Add this code to the top of the method:

    if ( get_current_blog_id() == 1 ) {
    	return null;
    }

    Note: Obviously, this will prevent you from editing the admin menu on the main site.

    Thread Starter fid

    (@fid)

    Ah, okay. But is there any way to save the changes for all sites except the main site. Your code only stops from loading the menu for it right.

    Plugin Author Janis Elsts

    (@whiteshadow)

    But is there any way to save the changes for all sites except the main site.

    No, or at least not without a lot of work. Given the way that the plugin is implement right now, you have two options: a) same menus on all sites or b) a different menu on every site. When using a global menu configuration (i.e. option A), there’s a single database entry that is used by all of the sites. No exceptions.

    You could switch to using per-site menus, but then you would have a different problem: you’d have to make your changes on every individual site. With a per-site configuration, there’s no bulk update.

    Is there some reason why you have to edit the menu on the main site specifically? You could just do it on another site, and, with the code I posted, your changes would show up on all sites except the main one.

    Your code only stops from loading the menu for it right.

    This is correct.

    • This reply was modified 7 years, 7 months ago by Janis Elsts. Reason: Adjust formatting
    Thread Starter fid

    (@fid)

    Thanks, your code was what I was looking for. What I wanted to do was to create a menu template from all sub-sites and not let it effect the main site. So your code edit did just that.

    I hope there is a setting in the future updates that one can select whether to ignore the main site or not.

    Plugin Author Janis Elsts

    (@whiteshadow)

    Thank you for the feedback!

    That setting seems like a bit of a niche feature, but I might add something similar eventually, like a setting that lets you choose whether to use the global configuration or a site-specific configuration on the current site.

    Will the code above work if the plugin is in MU-Plugins?

    Plugin Author Janis Elsts

    (@whiteshadow)

    I don’t see why it wouldn’t, but I haven’t actually tried it.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Multisite Issues’ is closed to new replies.