You’re able to import menu items. The post type handle is nav_menu_item.
You have to add some custom fields such as _menu_item_type for menu items.
If you know the detail, please see your database.
Can you post an example inside a spreadsheet of how this would work? What about dropdown menus?
Thanks for the reply.
Here is what I found:
https://dl.dropboxusercontent.com/u/340520947/Screen%20Shot%202016-09-08%20at%201.05.35%20PM.png
It seems like you need the post_id ahead of time. Is there a way to just give it the path you want it to use?
Example:
/New-Page
We know what all the post names are going to be so creating the link in the spreadsheet level would be awesome.
Ok I think I found all the row names but I am not sure how to first create a menu then add the items to it.
Would one of the rows have this
post_title –> News
post_status –> publish
post_type — > nav_menu_item
Now a new row with the menu items?
How do the menu items know they are part of the menu above?
// Insert new nav_menu_item
$nav_item = wp_insert_post(array(‘post_title’ => ‘News’,
‘post_content’ => ”,
‘post_status’ => ‘publish’,
‘post_type’ => ‘nav_menu_item’));
add_post_meta($nav_item, ‘_menu_item_type’, ‘post_type’);
add_post_meta($nav_item, ‘_menu_item_menu_item_parent’, ‘0’);
add_post_meta($nav_item, ‘_menu_item_object_id’, $page);
add_post_meta($nav_item, ‘_menu_item_object’, ‘page’);
add_post_meta($nav_item, ‘_menu_item_target’, ”);
add_post_meta($nav_item, ‘_menu_item_classes’, ‘a:1:{i:0;s:0:””;}’);
add_post_meta($nav_item, ‘_menu_item_xfn’, ”);
add_post_meta($nav_item, ‘_menu_item_url’, ”);
ok I have been at it for a bit and here is what I got. What am I missing?
Sample:
https://dl.dropboxusercontent.com/u/340520947/import_menu_sample_v8.csv
Any help would be greatly appreciated.