I tried with the name and the slug and different menus but I always
find that error.
Did you try with location slug? Take a look at where your menu location is defined (functions.php), for example:
register_nav_menus( array(
'primary' => __( 'Primary Menu', 'mytheme' ),
) );
On Appearance->Menus assign your menu to that location.
And then run your code starting with:
$menu_name="primary";
Related Posts:
- How make top level menu item not have link, but have sub-menus that are linked?
- How to Hard Code Custom menu items
- Removing container from wp_nav_menu not working
- Check if page is in a certain menu
- How to stop mobile theme inheriting desktop navigation menu?
- Increase search results for Admin -> Appearance -> Menus -> Search (default is 10)
- Is it possible to add classes to list items in wp_nav_menu()?
- How do I add the data-toggle=”modal” data-target=”#myModal” attribures to a WP Nav bar?
- if role is logged in then do something
- Nav menu items disappearing (but not immediately)
- Page not appearing in navigation bar
- How to add text before WordPress menu item href
- Nav walker, bootstrap: Display 3rd level items under 2nd level
- Remove nav_menus from customizer using a theme
- Extend WordPress REST API to show slugs for menu items
- WordPress Custom Menu Widget Style
- Output menu navigation in php file
- Custom Post type menu highlighted in the archive/post
- display only the wp_nav_menu, which has the current-menu-item
- Unclickable Menu Item Label in Custom Menu with Clickable Children
- Add tabindex to navmenu
- wp_list_pages sort order is different for different languages [closed]
- Remove Metabox from Menus screen
- I’m having a lot of trouble since upgrade to 3.0.1 with get_page_children() function
- How can I add a link to a WPForms “contact us” form to the main menu?
- How to fix “Supplied nav_menu_item value missing property” after update to WordPress 5.0
- How to add programmatically all pages and children to backend menu
- WordPress 3.5 dropdown menu
- Separator for custom nav menu
- WP Menu Walker – How to know total depth from inside the start_lvl() method
- How do I add recent posts to the menu?
- Conditional secondary menus
- Create a MegaMenu using a walker and the start_lvl function
- Nav and logo loading each time causing menu to move JointsWP – Foundation 6
- Creating a menu containing categories and authors
- Change submenu markup
- Get page slug/id from position in menu
- Two different “Home” items in custom menus dashboard section
- list category posts under its item in menu
- How to re-arrange the MENU of “Allure Real Estate Theme for Placester” wordpress theme?
- Use another menu when logged in
- Using _s theme, menu changes do not affect header menu
- Change class-name on “current_ancestor” in wp_nav_menu
- styling wp_nav_menu – horizontal, sub-menu drop downs
- Show children (sub-navigation) of active menu item only
- Highlighting top level link when viewing one of it’s sub-pages, which are not linked in the menu
- Make menu items open in new tab/page
- Adding top level items in the admin menu that link to a post
- How do I hide “Pages”, “Media”, “Comments”….for editor role?
- how to change the color of menu text wordpress?
- Twenty Fifteen: Change navigation menu behavior
- Need a menu on left sidebar of the page with below requirements [closed]
- add login menu with submenu
- How to make top level menu think it has a current item
- Generate Navbar In WordPress
- Showing home button in a specified menu
- Odd spacing in Navigation Bar [closed]
- Registering a static menu?
- Add session or cookie to remember last menu location
- Is there any way to change the CSS class applied to 2nd level sub menu ul’s?
- sub.menu’s not working
- How to change how WordPress renders navigation menu on Block Themes
- url_to_postid method in walker_nav navigation menu causing exceptionally high TTFB
- Add Different Class on Different Ul in twenty-twentyone theme
- insert an HTML element if there is a submenu only
- wp_nav_menu container style args
- Structuring Nav Menu and Background Custom page (Help)
- How To Add The Help Scout javascript LiveChat from the WordPress menu
- Adding additional html to the end of the root level in a custom nav walker
- wordpress custom menu – show parents, siblings, children depending on depth
- add_theme_support( $feature=’menus’ )
- How to swap text in menu item back and forth?
- How to remove Nav-Menu tooltips? (Wp-Globus plugin)
- Build a one-page navigation within a non-one-page ttheme…
- Change menu for mobile
- Add class to specific li item menu in function.php
- WordPress customizing a walker menu class
- how do you create this customize menu using wp_nav_menu function?
- Show thumbnail to category items in wp_nav_menu(), how?
- Primery Menu Configuration problem
- Disappearing items in menu
- Menu not saving in dashboard
- Where these arguments are defined?
- How do i keep my current page menu highlighted on pagination?
- Menu support for touch devices
- WordPress Flyout Menus
- Pick out specific menu item from code
- Show All Children of WordPress Menu
- menu doesn’t show in different languages
- How to make an anchored page in a navigation menu tab
- highlight parent page on menu when child page is on sidebar (and not on menu)
- nav tag wrapping around dropdown
- Resolve the debugs
- Sub menu for a (single) page
- WordPress “add to menu” button not working
- Primary menu shortcode name
- register_nav_menus and wp_nav_menu issue, not displaying independent menus
- Convert a custom bootsrap based menu to wordpress nav walker
- change breakpoint widths for divi theme tablet view
- Problems with the navigation menu