I recently began experimenting with WordPress Multisite and I'm running into an issue with the primary navigation menu. Instead of showing the items in the menu that's registered as the primary menu, it just lists around 20 pages.
I'm using the same theme as the master site on the network and I've copied some of the tables (posts, terms, and most options) from the master site. The tables were copied directly in MySQL and not through a plugin.
This is the code I'm using in the header to insert the main nav menu and it works on the master site:
<?php wp_nav_menu( array(
'theme_location' => 'main_nav_primary',
'container' => false,
'menu_class' => 'main-nav__primary__list loading'
) ); ?>
The menu is registered in functions.php
, and I've added the menu as the primary menu in the theme locations.
I looked in my options table for relevant options and listed them below. There may be more options I didn't find with my query.
+-----------+-------------------------------+-------------------------------------+----------+
| option_id | option_name | option_value | autoload |
+-----------+-------------------------------+-------------------------------------+----------+
| 103 | widget_nav_menu | a:1:{s:12:"_multiwidget";i:1;} | yes |
| 485 | nav_menu_options | a:2:{i:0;b:0;s:8:"auto_add";a:0:{}} | yes |
| 4016 | wp-optimize-enable-admin-menu | false | no |
+-----------+-------------------------------+-------------------------------------+----------+
Do multisite menus have to be configured differently? I've set up my network to use sub-domains, also.
nav_menu
taxonomy andnav_menu_item
post type, maybe you've broken some associations between those objects and the actual posts/pages they reference when you copied the tables over. The other guess is maybe the query for your menu items is getting hijacked by some improperly targeted code, like a query filter orpre_get_posts
action.fallback_cb
argument ofwp_nav_menu
. it's possible it is failing to find the menu and is outputting a list of posts as a fallback.fallback_cb
wasn't specified and was defaulting to those pages. I guess now I just have to figure out why that menu isn't being found.