How to assign a WordPress 3 menu to “Primary” location programmatically?
-
I’m trying to create WordPress 3 menu programmatically.
Here is the code that I wrote to make it:
$menu_id = wp_create_nav_menu('my_menu');
wp_update_nav_menu_item($menu_id, 0, array('menu-item-title' => 'First Menu Item', 'menu-item-url' => 'https://suhanto.net', 'menu-item-status' => 'publish'));
and now I want to assign the $menu_id to “Primary” navigation location. I already looked into the source code in wp-includes/nav-menu.php and wp-includes/nav-menu-template.php and so far I haven’t found a function that achieves that goal.
So, anyone know how to assign a menu id to “primary” navigation location programmatically in WordPress 3.0?
Viewing 8 replies - 1 through 8 (of 8 total)
Viewing 8 replies - 1 through 8 (of 8 total)
- The topic ‘How to assign a WordPress 3 menu to “Primary” location programmatically?’ is closed to new replies.