My theme has a custom menu called “Custom Header Menu” and i’ve got a plugin that sets up site defaults and creates my static pages that I’d like to customize in order to seed the custom menu with posts and pages on the fly.
So I’d like to add some code to the plugin so that each of the page’s I’m creating gets added/assigned to the custom menu.
I’m just looking for a point of reference on how to add pages to a custom menu on the fly via script…
From wp-includes/nav-menu.php, I’m expecting to use this…
wp_update_nav_menu_item( $menu_id = 0, $menu_item_db_id = 0, $menu_item_data = array() )
Where $menu_id is the id of my “Custom Header Menu” and $menu_item_data is an array of the pages I’m assigning to the menu.
I guess it doesn’t need anymore explanation:
Can you post the name of your plugin? Maybe someone has already a solution for this specific question.
I cannot give u a solution. Haven’t much played around with the “new” wp-navmenu feature so I can only make some suggestions: