Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

So I'm basically upgrading an older site and I need to make it multisite as well for some blogs and such.

I'd like to have the main site Menu(created from the admin) available on the other sites in an elegant way. That is, every site has a theme and it would be nice if I could just wp_nav_menu() on every one.

Any ideas?

I took a look at switch_to_blog() but I see it's deprecated.

Cheers!

share|improve this question
1  
I don't think that switch_to_blog() is deprecated. –  Michal Mau Aug 19 '11 at 19:10
1  
To avoid further confusion: WPMU_Functions/switch_to_blog() IS deprecated but Functions/switch_to_blog() IS NOT. –  Michal Mau Oct 25 '11 at 22:18

2 Answers 2

I'd say: Write a short plugin that offers a simple function to output a menu. Then activate it network wide.

share|improve this answer

This is what I've used recently. It's very simple but it works well for me.

    function wp_multisite_nav_menu( $args = array(), $origin_id = 1 ) {

        global $blog_id;
        $origin_id = absint( $origin_id );

        if ( !is_multisite() || $origin_id == $blog_id ) {
            wp_nav_menu( $args );
            return;
        }

        switch_to_blog( $origin_id );
        wp_nav_menu( $args );   
        restore_current_blog();

    }

I've thrown this into a mu-plugin file that hosts a lot of small hooks and functions intended to run network wide.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.