You can use wp_get_nav_menu_items https://developer.wordpress.org/reference/functions/wp_get_nav_menu_items/ function to get your menu items in the form of an array , you can pass any of Menu ID, slug, name, or object in wp_get_nav_menu_items function.
$locations = get_nav_menu_locations();
$main_menu = wp_get_nav_menu_items($locations['primary']);
print_r($main_menu);
Related Posts:
- How do I add a search box to the nav menu?
- How to get IDs for objects in menu branch?
- New post notification in wp_nav_menu
- WordPress Menu Custom Walker Class
- How to change order of menu items
- How to use a WordPress’ existing admin icon?
- How to move parent li to end of child ul
- Show child pages by menu order using Superfish Dropdown menu?
- Bootstrap drop down menu with wp_nav_menu
- Remove ‘Menus’ from Twenty Sixteen theme Customizer
- One site, 2 distinct sections: two different top nav menus?
- Can you have different menus and theme on a per-page basis?
- Adding a within ‘s from wp_nav_menu()
- Custom nav walker with different output depending on depth
- Get menu item slug
- Display link with current user’s username in it in Custom Menu
- Add class to menu ul with active child
- jQuery cookie not working properly in wordpress
- Check what “type” a menu item is
- Automatically generated menu
- Admin only menu/page
- wp_nav_menu_items filter :: custom menus fall outside ul class
- Add within the output of
- Add CSS to head depending on nav menu walker
- WP MU: Using pages from main site in other sites’ menus
- How can I add items to the menu via the PHP file?
- WordPress warning: “private_to_published” Deprecated when creating nav with wp_update_nav_menu_item()
- display menus on all page except one?
- two different separate sections on the same site
- how to disable default menu classes
- Adding an admin menu page showing the link twice – how to solve this?
- How to customize submenus isn wordpress theme [closed]
- custom walker nav issue involving ajax
- How to add html attributes to the “ul” html tag with “wp_nav_menu” function?
- Can I have a different menu for each parent page?
- Conditional menu display
- Give child-categories same class (the parent category-slug) as parent in menu list?
- Combine 2 categories in one Menu item
- Wrap list parent in div with wp_nav_menu menu
- WordPress Menu Exchange On Tablet’s Orientation
- How to add a element with walker menu right after begin of the navigation tags?
- Custom Menu not functioning properly
- Using front-page.php need new blog page
- Increase wordpress menu Depth
- How to hide the menu item created by the theme in WordPress admin panel?
- Custom menu walker – remove li tag based on class name
- Hide pages from the main menu
- How to customize the built in menu in wordpress?
- Current author archive in navigation menu
- Adding CSS-class to WordPress Menu in backend
- If child is active add class to parent in customWalker
- How to get or know the slug of home.php
- Set first level items to in wp_nav_menu()
- Difficulties filtering manage_nav-menus_columns
- How to create menu spread over four lines including images
- plus sign not working in widget “Header: Nav Menu”
- Do not hyperlink menu heading
- Adding conditional classes to wp_get_nav_menu_items
- Auto delete menu items with zero products (woocommerce)
- current-menu-item not apllying with wp_nav_menu() on ajax
- Custom link with checkbox that adds additional word to checked menu items
- menu not showing on mobile view
- Why is my navigation in my onepage not working?
- Admin menu in different languages
- Hide a menu (navigation bar) on all posts
- Edited one page in my working menu and now all menu buttons don’t open unless I right-click and open in new tab
- Need help with Walker_Nav_Menu class
- Impossible to remove page from menu
- Is it possible to have submenu outside of menu element? I dont want submenu to be a child of menu
- Bootstrap Nav Walker Sub Menu Image
- What are some of your favorite methods for creating an accessible menu?
- Add active class to wp_nav_menu
- How to get all the menu listed in Menus Created inside the Apperance Menu?
- how to configure this type of menu
- Migrate WP Menu between sites
- Add Class to Custom Menu Widget ul
- Add parent link to its submenu
- Can’t change link for navigation item
- Show Child of Parent Page including all other parents
- Loading wordpress menu in an external server
- Need direction on a seemingly complex menu walker for automatically inserting a parent link li in it’s submenu ul
- Show only second level menu items? [duplicate]
- Add item ONLY to the primairy navigation
- wp_nav_menu in 3.7 add name class nav navbar-nav
- Prevent Menu Shortcode From Formatting
- individual images as navigation design TwentyTen
- Setting up menus before making a template live
- Is there a limit to number of pages displayed for selection in custom menu?
- Is it possible to add a superscript trademark symbol to a menu?
- Creating a Horizontal menu
- 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
- How do I get the menu items based on name or ID?
- Menu problem : when add wordpress element in menu it convert into empty custom link
- Add acf custom fields so sub item in menus
- change breakpoint widths for divi theme tablet view
- Problems with the navigation menu