You need to move return $items;
outside of the if
check. Currently, you are only returning menu items when the theme location is primary
, all other menus will have no menu items if you return nothing for those.
Related Posts:
- Dynamically exclude menu items from wp_nav_menu
- Add custom menu item using wp_nav_menu_items filter
- Custom search filter causes menu and query_posts problems
- Unregister Nav Menu from Child-Theme
- Allow html tags in WordPress Custom Menus Description Field
- Using filters to change href of nav menu page link
- How to apply a class to the second word in menu list item?
- WordPress nav_menu_link_attributes Not Working
- Is it possible to add a filter for the output of nav-menu items in admin?
- if role is logged in then do something
- Filter menu item to add classes/attributes?
- Edit html for menu items in default frontend menu
- Set Item Order with wp_nav_menu_{$menu->slug}_items
- When at / ( or “home”) my menu doesn’t get a current-menu-item class
- How to add parent element’s title to nav menu’s child?
- Why is ‘nav_menu_item_args’ filter’s $item argument empty?
- Add class to active element and its parent in nav menu
- display only the wp_nav_menu, which has the current-menu-item
- Removing strip_tags not working on nav_menu_description
- Third level navigation class
- How to add #navbar to all page links?
- add span to top level links of a wordpress menu called “main”
- Debugging – trying to add search box to menus
- wp_list_pages() but only show children on the branch you are on
- From a page, is it possible to find entry’s “menu_item_parent”?
- Add active class to top-level menu items when viewing single for that post type
- add_filter on menu items to add a menu item
- how to disable default menu classes
- Insert other menus as submenus of a main menu
- list category posts under its item in menu
- Prevent menu from loading in a page template [duplicate]
- Insert a div before the wp_nav_menu
- How to change menu structure?
- remove specific classes from menu items
- wp_nav_menu action/filter help
- add_filter for where statment issue
- Add a counter beside menu item label
- Add custom link on the fly to nav menu
- menu-item class missing on wordpress menu
- Filter to hook into menu items and add a custom attribute
- if role is logged in then do something
- Possible to append class to nav menu added to widget area?
- Modifying Woocommerce menu based on tags and categories
- Why does WordPress convert absolute URLs to relative URLs for menu items?
- Menu location switcher – example code fails
- Add Featured Image and Title to wp_nav_menu items
- Show thumbnail to category items in wp_nav_menu(), how?
- Add Class to Custom Menu Widget ul
- Avoid changing menu query with suppress_filters => false
- Removing menu item doesn’t get removed on edit post
- Add Protocol to Custom Menus
- How to modify menu text in callback function of ‘walker_nav_menu_start_el’ hook
- Why is WordPress stripping anchor links from mneu item URLs?
- Add button and title on submenu WordPress
- I only want to show links to categories that have posts in ‘publish’ state in my menu
- nav_menu_css_class add_filter is never called
- In WordPress, I want to use code to filter out one menu item (page) from displaying when I call wp_nav_menu() function
- Display a portion/ branch of the menu tree using wp_nav_menu()
- Programmatically add a Navigation menu and menu items
- Any docs for wp_nav_menu’s “items_wrap” argument?
- Customizing Only a Specific Menu using the “wp_nav_menu_items” Hook?
- Changing the Order of Admin Menu Sections?
- How make top level menu item not have link, but have sub-menus that are linked?
- Add ‘has_children’ class to parent li when modifying Walker_Nav_Menu
- Get WP Navigation Menu from REST API V2
- How to Hard Code Custom menu items
- How to add a Custom Link to a Menu with a URL that is relative to the blog URL
- How do I remove UL on wp_nav_menu?
- Retrieving a list of menu items in an array
- WordPress default menu in database
- Adding an Arbitrary Link to the Admin Menu?
- Add “Logout” link to navigation menu
- Error: Declaration of MyClass::start_lvl() should be compatible with that of Walker_Nav_Menu::start_lvl()
- Split up wp_nav_menu with custom walker
- Removing container from wp_nav_menu not working
- Custom Nav walker display current menu item children, or siblings on no children
- wp_nav_menu: show menu only if one exists, otherwise show nothing
- Is there an easy way to replace a custom menu link with a page or post?
- Convert output of nav_menu items into a tree-like multidimensional array
- Get page IDs from nav items
- How to add sub-menu to a menu generated by wp_nav_menu by using plugin
- Add a custom walker to a menu created in a widget
- Using a menu walker add a custom item at the end of the menu’s items
- Add settings to menu items in the Customizer
- Apply the_title() filter in post & page title, but not in menu title
- wp_get_nav_menu_items() not working with slug
- How to get current-menu-item title as variable?
- Error “Trying to get property of non-object” with Custom Walker for wp_nav_menu
- Add Class to Specific Link in Custom Menu
- Remove a menu item in menu
- Generate a Menu that Displays Child Pages using wp_list_pages() with the New Menu Functionality in WordPress 3.0?
- How do I get the name of a menu in WordPress?
- How to Add to Each Menu Link with link text to data-attr?
- How to manually specify the current active page with wp_nav_menu()
- How to count nav menu items?
- How Does The Walker Class Work?
- Add Javascript to WordPress Menu
- Filter wp_nav_menu()
- How to modify navigation menu of the “My Account” page in WooCommerce
- remove “edit your profile” from admin menu bar