The helpers you’ll need are wp_create_nav_menu() and wp_update_nav_menu_item().
This will allow you to create a menu and then, using a query posts loop, programmatically add every page in your site dynamically.
You can use the get_pages() helper to retrieve all pages from the DB.
<?php
// These are default args and don't need to be set explicitly.
// I've included them here for reference.
$args = array(
'hierarchical' => 1,
'post_type' => 'page',
'post_status' => 'publish'
);
$pages = get_pages($args);
// loop goes here
// foreach or while will work, whatever you are comfortable with
?>
Related Posts:
- Add Javascript to WordPress Menu
- Add custom menu item using wp_nav_menu_items filter
- Custom search filter causes menu and query_posts problems
- Add separator to admin submenu
- register_nav_menus() won’t register menus
- How do I add nested categories to drop-down menu in twenty-eleven?
- Add custom page link with anchor
- How to include the ‘current-menu-ancestor’ class on a custom post type menu in WordPress?
- HTML Bootstrap navigation menu to WordPress menu using wp_nav_menu
- Getting URL value from menu item by ID
- Adding a class (arrows) to main menu links that have children?
- Is it possible to add a filter for the output of nav-menu items in admin?
- Adding html elements to wp nav menu
- How to change menu according to the language?
- add_action for saving a custom menu
- Highlight the “Home” / “Blog” button while on main page
- Getting post content within wp_nav_walker
- Nav Walker current menu item not displaying
- Navigation (wp_nav_menu) refuses to nest within parent element
- how to add Custom menu item like User name in Header Menu only
- Display three different levels of navigation from wp_nav_menu separately?
- Wp_Nav_Menu – Identify the last menu item
- Add custom menu item metabox in Navigation Settings
- Menus – Open items in new tab/window?
- Image as a link using wp_nav_menu()
- Highlight another nav item
- Populating main menu from external JSON API
- HTML in Menu Items disappear on save
- Add class active to static menu
- Update body class based on menu
- How to add fixed position in menu class for Twenty Twelve theme?
- How do I separate link levels in a custom menu walker?
- Possible Menu Hack?
- How to set my main menu items
- Allow users with Editor role to edit menus (without a plugin)
- Add custom links like functionality
- I need my dropdown sub-sub-menu box to show sub-menu title above
- Sorting child item of navigation menu using code in wordpress
- I want to hide the navigation menu on a particular page
- Difference between walker class and basic php
- Change hyphen/dash for vertical line in menu [closed]
- Allowing HTML in Menu Descriptions
- How to add class to parent a tag with a sub menu
- Listing Child Pages in a Certain Order?
- WordPress + Bootstrap [closed]
- wp_nav_menu action/filter help
- Trying to add a custom social icon to a Twenty Twenty-One child theme
- How to hide a menu from public, but share content with a private link [closed]
- Navigation menu not visible (contrast issue) on home page
- Tageting a specific menu link with nav_menu_css_class
- Full screen nav menu block with avada theme
- functions.php adding item to end of menu. I want to change position
- WordPress menu>Custom Link: removing my link formatting and adding %20
- Custom Menu Anchor Links Not Working
- WordPress Menu Exchange for Mobile Layout
- Switching to child theme breaks menu names
- Wp_list_pages not showing children with custom page template
- How to check if current page is a parent item or child item in a given menu
- How to implement a secondary menu?
- Buggy wp_nav_menu?
- Styling issue with custom menus and sub menus
- When I click a custom menu link, how do I make it update the URL in the browser to the external link?
- Disabling tooltip on menu items
- Divide Menu into Separate Menus and Display them Side by Side
- Hook or callback when wp_nav_menu() has completed
- if role is logged in then do something
- Set one or more menus as a submenus of another menu
- How to show submenu of any page in main menu
- WP Menu Rollover Nav Item and Effect DIV Elsewhere
- How to change the navigation menu
- WordPress nav_menu items from another menu appearing
- How to create a mobile menu full screen overlay using Understraps Bootstrap 4 theme
- adding drop down menu item to existing menu
- wordpress walker add class to submenu a href
- How to Hide/Remove Pages section in Menus (Dashboard)
- Unable to remove page from primary menu
- How to Use Default Auto-Generated Menu?
- How to sort a sub-menu, generated with get_pages(), by the page order instead of alphabetically?
- wp-nav menu with custom walker , how to remove a tag if it has any submenu
- Two questions about CSSing inside the menus
- Different menu on different category need advice
- Always show wordpress submenu on responsive header menu
- Is there any way to recover deleted menu from database sql backup
- Showing a link with Javascript based on log-in status
- Placing generated list into drop-down on custom menu
- How to make a drop down menu with categories
- How to use my custom menus as seperate pages?
- Building Menus with the latest posts included
- Cannot control wp_nav_menu properly
- wordpress superfish dropdown menu
- WordPress wp get nav menu items does not deliver external link
- wp_nav_menu changed to wp_page_menu
- how to assign an ID to a wordpress menu
- Site pages show the page title under navigation bar
- Keeping my Sub Menu open when hovering on its list items
- How to change the markup created by menu item only on chosen items?
- How to disable permalink of a particular menu item?
- Using walker to display all menu branches at once?
- How to add a class directly on a unordered list element that is a primary navigation
- How to change mobile menu (toggle) icon in WordPress – Full Site Editing?