admin管理员组

文章数量:1389889

I've tried adding a new programmatically on wordpress with the function:

 wp_update_nav_menu_item($menu, 0, array('menu-item-title' => $title,
            'menu-item-object' => 'page',
            'menu-item-object-id' => $post_id,
            'menu-item-type' => 'post_type',
            'menu-item-status' => 'publish', // is there any 'delete', 'unpublish' ??
            'menu-item-parent-id' => $parent
        ));

This works when I create a page but I want to change the parent or just update the page this function adds the page again in the menu.I want to know if there is a way I can delete or update the menu item from dhe menu?

I've tried adding a new programmatically on wordpress with the function:

 wp_update_nav_menu_item($menu, 0, array('menu-item-title' => $title,
            'menu-item-object' => 'page',
            'menu-item-object-id' => $post_id,
            'menu-item-type' => 'post_type',
            'menu-item-status' => 'publish', // is there any 'delete', 'unpublish' ??
            'menu-item-parent-id' => $parent
        ));

This works when I create a page but I want to change the parent or just update the page this function adds the page again in the menu.I want to know if there is a way I can delete or update the menu item from dhe menu?

Share Improve this question asked Oct 7, 2013 at 14:54 Antonio PapaAntonio Papa 1331 silver badge10 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

Try giving menu-item-status as draft instead of publish

本文标签: navigationUpdate nav menu item position programmatically