You are not providing the correct parameter to wp_get_nav_menu_object()
function. It needs the menu ID or menu slug but you are providing the menu theme location. Obviously, I can not tell you what is the ID or slug of your menu.
One way of getting the menu ID of the menu assigned to theme location is using get_nav_menu_locations()
:
$menu = wp_get_nav_menu_object( get_nav_menu_locations()['primary'] );
echo $menu->count;
Related Posts:
- Extend walker – navigation, adding data attribute to a tag
- Hide Login information in Account settings in Buddy Boss
- Add clickable arrows to parent menu items with children elements e.g. with
- How to wrap the list with custom class using wp_nav_menu?
- Help with walker for nav
- Sticky menu for WP custom menubars
- Insert menu with a custom walker into page / post body using shortcode?
- Implement a Walker with custom object rather than WordPress database object
- Position a hard-coded menu item
- How to request container_class from wp_nav_menu
- How to add active state to the navigation links?
- Customize Widget Navigation
- Custom menu not showing even though it shows as being registered?
- Current menu item highlights wrong
- remove or hide Link Relationship (XFN) form Menus tab
- Class .current-menu-item in custom menu Walker
- removing extra mobile menu from the header
- Custom Menu (only showing direct cildren) ACF not showing
- Mega Menu Walker
- Does Extending Multiple Nav_Menu_Walkers Allow Nested Menus?
- Add custom html to last sub-menu item
- Call custom field into menu item
- wp_nav_menu() custom container and container_id
- Show a WP 3.0 Custom Menu in an HTML Select with Auto-Navigation?
- Add Page ID class to nav menu items
- Walker class: Problems with understanding how walk() method can be called without error
- Adding Custom Link anchors in the top menu that points to specific sections of the site home page
- wordpress custom walker for thumbnails with custom menu
- Bar separated navigation by extending Walker_Nav_Menu
- simple expandable vertical menu, java script problem
- wp_nav_menu doesn’t generate parent/ancestor classes
- how to change WordPress menu markup/classes
- wp_nav_menu google analytics event tracking
- Only append custom classes to nav menu items
- `start_el` depth argument in custom nav walker always evaluates to zero
- Benefits of using Nav Walker?
- How to extend nav-menu-item-control data in Appearance > Customize?
- Use walker for specific menu, or avoid use of walker
- Comments not nesed with custom template
- has_children in custom nav_walker
- Adding post excerpt into navigation menu
- Nav Menu – Add class based on meta keys
- Trouble creating conditional PHP for nav menu items with children for custom Walker
- How do I create page navigation linking to each H2 within the page? [closed]
- Putting tag outside tag on generated Menu
- Change an li class name in a wordpress custom menu walker
- How to create left and right menu with logo center in a custom theme?
- Custom Walker_Nav_Menu issue with variables on PHP 7.3
- walker – 0 level on submenu formatting
- Determine the last child of the parent menu WP Nav Walker
- Create menu / submenu from category subcategory and posts
- Navigation doesn’t render when wp is hosted
- Navigation label for page in custom theme
- Custom Navigation build using wp_nav_menu and walker
- WPML Plugin Not displaying multilingual Menus
- Using _s theme, menu changes do not affect header menu
- how to display a specific wordpress menu?
- Create a url structure for my blogs based on categories and sub-cats
- Looking replicate static HTML Menu into WordPress Dynamic Menu [closed]
- Custom font size nav bar
- Show children (sub-navigation) of active menu item only
- Stop Expansion of Top Level Menu in the WordPress Admin Sidebar
- Remove a class from a using Walker
- How do I create a root link in wordpress to a PDF file?
- How can i create menu like in the example?
- WordPress custom dropdown listings
- How to have multiple WordPress Menus
- wp_list_pages Hierarchical Help
- Costum walker with sub menu item count
- Missing current_page_item in custom menu
- WordPress menu: How to make www.link.com/#name never contain current_page_item class?
- How to retain visual breadcrumbs w/ tricky URL structure? Custom post template?
- How do I add 3rd level of dropdowns to wp_nav_menu array?
- How to get Previous Visited Page Information
- url_to_postid method in walker_nav navigation menu causing exceptionally high TTFB
- Woocommerce custom “My Account” Tab – Add Save button
- Can I now add a class in the anchor of my menu item with WordPress 5.4?
- Multi-Level Nav Bar
- Adding a drop-down (select tag) option under Menu Settings in WordPress Admin
- Adding additional html to the end of the root level in a custom nav walker
- Change markup for just 2nd list element in custom Walker menu
- How to create custom post type selection to nav menu
- How to customize WordPress vertical menu?
- Creating a dynamic URL for an external link inside content
- how to hard link to the posts page?
- Creating a Treeview Listing of a Directory
- Conditional Nav Menu Inside Nav Menu Across Multisite Sites
- How to add odd and even classes to all nav links through walker?
- Output sort number in wp menu list item?
- How do I display entries in the top menu based on conditions selected in the sidebar menu?
- Buddypress: New Tab and Page (Members Profile) [closed]
- Check in walker if current page is descendant
- Add dynamic content block to nav section generated by custom walker
- Customize Walker_nav_menu to show posts if item is category
- Add the “.current-menu-item” class to tag?
- Walker for menus
- menu customization
- How to move menu next to left of the search box?
- Custom CSS File wont work on second Page
- how can i get the page_ID in nav li [closed]