You just need the last part of your function where you switch to blog 1 and get the menu.
function wp_multisite_nav_menu() {
$args = [
'menu' => 'Main Menu',
'theme_location' => 'main-nav'
];
switch_to_blog( 1 );
echo wp_nav_menu( $args );
restore_current_blog();
}
Related Posts:
- Difference between the_permalink() and get_permalink() function
- Prevent “main” WPMU site_url() being returned in functions
- Use author author display name in permalink structure for pages and posts
- paginate_links() don’t properly work in search.php?
- Remove Container Element From wp_nav_menu() Markup
- Refresh page after form action
- Implementing DNS Prefetching with WordPress
- Breadcrumbs showing Parent and Child Pages
- Return only top-level navigation items from a menu using wp_get_nav_menu_items
- Convert hyphen to underscore in permalinks
- Different functions file for each site in multisite installation?
- Adjust which tempalte a page uses with a function?
- Generate permalinks
- Delete pages and Create default pages for all new network sites
- Multisite, either change the name of sample-page or create new page
- Disable shortlinks like ?p=1234 to prevent scraping
- Loop (iterate) through Multi-Site sub-sites (blogs)?
- Global functions on WPMU
- Menu fallback “menu_class” rendering a “div” instead of a “ul”
- restore_current_blog required after switch_to_blog, if I use that in a function?
- Breadcrumbs – Exclude Child Categories
- Manipulate Permalink
- How do I create page navigation linking to each H2 within the page? [closed]
- Run function when WordPress new multisite is created or ACF field is updated
- Custom Static Links For Specific Menu Right Before/Next The wp_nav_menu Function now working
- Conditional Gravity Forms filter in WordPress Multisite
- Multisite Ajax serialize return error [object Object]
- Categories as main menu items and subcategories as nested lists
- Creating new blog on multisite programatically without hacks?
- Where to add the permalink in this function?
- Multisite 404 on pages – rewrite error breaks database
- paginate_links() don’t properly work in search.php?
- Has is_archived() for sites in a multisite changed with WP 4.7?
- append to existing parent theme function
- Function that outputs second theme url
- How to fix get_the_category function returning incorrect slug?
- Test if a post exists by category and date
- retrieves menu and converts it to a readable array
- Secondary Menu and Logged In Users
- How to properly refresh page after form action?
- dynamic site link for future migration in echo do_shortcode()
- Default Nav Highlight
- Setting Permalinks in wp_config or functions file?
- Multiple navigation menu in same location
- Redirect to post after publish or update a published post
- wp_get_attachment_image_src returns image on main domain, false on subdomain
- functions.php return custom text
- Dashboard blocker on network multisite for specific user roles
- How would I make a function to dynamically determine if user is logged to change navigation menu text?
- Members only function, but allow account activation [solved]
- How to add extra value to permalink
- Bizarre Child Menu Issue on WP Site
- How Can I Create a Friendly Slug for a Dynamic Page?
- Add #primary at the end of navlink permalinks on single posts
- How to automatically add counted number to navigation menu items?
- Competing Login Redirects – Need to be Combined?
- Adding a class to the body of an inactive site using multisite
- Filter posts on new page
- How to add widget in main menu
- Setting Active Nav item (of Pages) when you are on a Post with Category
- Check if excerpt is empty at loop-portfolio
- Exclude javascript in certain page url and all following url’s after forward slash
- Undefined offset: 2
- Run function from parent on child site
- Ads Only at one website inside multisite network – code error
- Different ads on every website on multisite environment
- Why use if function_exists?
- Include files in child theme functions file
- How to get woocommerce inventory status [closed]
- Why do I get Fatal error: Call to undefined function get_most_recent_post_of_user()?
- Checked() showing up twice in custom fields
- Gravity Forms field entries into wp_query loop [closed]
- Update Content based on expiration time or queued processing
- Adding to fontawesome-webfont.woff2 to boost website speed
- How to enable template page only for a post id page
- Remove after images
- Get First Child Page ID or Permalink in WordPress Admin
- Footer disappears when using the_content ( )
- Get page id or status by private pages?
- Custom taxonomy widget in admin area
- What is the Difference in bones_comments() and comments.php
- Do I need to use wp_reset_postdata for my function?
- Split Media Queries in different files!
- how to make has_block() see inside blocks too
- add_theme_support( ‘title_tag’ ) is not showing title on index.php
- Tracking the number of shortcodes for a list?
- remove edit link only for published post and pending post
- When are the user meta fields created in the database? Admin vs Woo API REST
- Insert Modal on user first login
- Correct way of Enqueue self hosted fonts in sass project
- function syntax is off,
- WordPressMU: URL change and broken permalinks/links
- Change category checkbox into radio button [duplicate]
- Show the online status of the current post’s author
- How does child theme functions.php work with parent theme functions.php? Is it like CSS? [duplicate]
- restrict access to specific urls on a specific period of time
- Need a functions that adds (adm)/(mod) if current user is admin/moderator right after their username
- clickable title of 2 post on mainpage USING functions.php
- Custom Post Type Search
- comment_post function with js not running