I don’t think you can use a menu for that, as menus are created manually in the Admin Panel.
You will have to use wp_list_categories
like this:
$categories=get_categories();
$rand_keys = array_rand($categories, 5);
foreach ($rand_keys as $key) {
$cats .= $categories[$key]->term_id .',';
wp_list_categories('include=".$cats);
Related Posts:
- Customizing Only a Specific Menu using the “wp_nav_menu_items” Hook?
- Using a menu walker add a custom item at the end of the menu’s items
- Add settings to menu items in the Customizer
- Generate a Menu that Displays Child Pages using wp_list_pages() with the New Menu Functionality in WordPress 3.0?
- How Does The Walker Class Work?
- WordPress Shortcode in Menu Item Title
- Calling the Menu Title within wp_nav_menu array function
- How to hide an item from a menu to logged out users (without a plugin)
- Menu items (all menus) being deleted randomly on their own [duplicate]
- Large WP 3.0 menu times out and won’t save
- How to apply a class to the second word in menu list item?
- Put a wp_nav_menu inside another one
- WordPress wp_nav_menu within iFrame
- Generate a Menu that displays all child pages of top level parent
- Terms with more than one occurrence have current-menu-item class in menu
- Check if wp_nav_menu items have submenus
- start_lvl on Walker is not working
- How to get Menu Navigation Labels to output HTML
- custom menu not found
- wp_nav_menu doesn’t generate parent/ancestor classes
- WP_nav_menu fallback not working
- How to conditionally register nav menus with advanced custom fields?
- Pending Custom Link in Menu
- Benefits of using Nav Walker?
- Change where navigation bar links?
- Social Links Menu displays icon instead of text (twentyfifteen) [closed]
- has_children in custom nav_walker
- Does wp_nav_menu use the gettext filter?
- How to add #navbar to all page links?
- How to add wechat (weixin) link to navigation menu?
- Create search form in menu as in Twenty Fourteen theme
- Link that refers to a menu item with dynamically generated URL
- Custom walker nav – Add sequential number as class
- WordPress Custom Menus Issue
- Side Menu Icon Expandable
- wordpress responsive menu not dropping down
- delete all post with certain meta_keys
- Make nav-menus.php available for editor
- how to add custom wp_nav_menu class css selector to ul and a tags?
- WordPress default menu in database
- If menu has submenu, add parent as first child
- Create subpages in default WordPress menu
- Admin-ajax.php 500 error when Add to menu is clicked in admin
- replace existing menu programtically
- Submenu page buttons are blank
- How to add an attribute data-slug = “$specfic_page_slug” in WordPress menu item?
- Main menu gets replaced when second menu is created
- Hide menu items if the page content is empty
- Theme only supports one menu? [closed]
- Problem adding ‘has-children’ class to wp_nav_menu
- exclude pages in custom menu
- set certain item in nav walker to active when on archive pages or singles
- wp_nav_menu() | Outputting my own custom code using built in features
- How to reference argument data for wp_nav_menu() from functions.php
- Creating menu always gives error A name is required for this term
- Showing the same menu in multiple location
- Creating custom menu with custom themes
- Expected snippet value not showing
- Wp Nav Menu div containers
- wp_nav_menu with WP as pure CMS
- Simple form to add custom links to menu?
- Add posts from a category to menu with all posts in it as sub menu
- Possible to append class to nav menu added to widget area?
- Page dependent sub-menu?
- Making the menu toggled open on mobile devices Illustratr theme
- How to include second layer sub menu to Walker Nav?
- need help in wordpress navbar setup
- How can I creat custom menu with bootstrap
- Removing wp admin menu item on top bar of admin backend
- Error: Declaration of MyClass::start_lvl() should be compatible with that of Walker_Nav_Menu::start_lvl()
- WordPress nav-menus not finding page
- Restrict user to edit only edit a certain menu
- Primary menu items are dissapearing
- Where is the source code in the console coming from?
- Migrate old blogroll to menus automatically
- Getting parent object_id of child menu items in WordPress menu
- How to remove a sub-menu using walker hooks/filters without relying on a custom walker?
- display cart information within li of cart menu item
- Calling wordpress menu outside ignores custom menu item
- Specific Page that convert Hyperlink to anchor in nav menu
- Removing menu item doesn’t get removed on edit post
- change link of menu particular tab
- Next page link via the custom menu
- How can I make this custom design menu work in wordpress?
- Active menu item / category
- Add different span class to wp nav menu
- Top menu link anchor href value change after online server?
- Menu not always using correct link
- Custom Menus and taxonomies
- Help with changing style of the extended menu drop down [closed]
- How we show pages in dropdown
- wp_nav_menu doesn’t show on index page
- How to add posts with thumbnails to my dropdown menu?
- Automatically add new posts to a specific menu name
- can anyone help me converting my static menu to wp_nav_menu I’am trying to add static menu item to WordPress Menu
- Elegant way of adding an CTA to a menu
- Theme supports only one menu. I need to add more – but how? [closed]
- How to set menu Display location
- How to add custom menu to block theme?
- How to change mobile menu (toggle) icon in WordPress – Full Site Editing?