'menu-item-xfn' => '',
'menu-item-status' => '',
'menu-item-post-date' => '',
'menu-item-post-date-gmt' => '',
);
$args =
wp_parse_args( $menu_item_data,
$defaults );
if ( 0 ==
$menu_id ) { $args['menu-item-position'
] = 1;
} elseif ( 0 ==
(int) $args['menu-item-position'
] ) { $menu_items = 0 ==
$menu_id ? array
() :
(array) wp_get_nav_menu_items( $menu_id, array
( 'post_status' => 'publish,draft'
) );
$last_item =
array_pop( $menu_items );
$args['menu-item-position'
] =
( $last_item &&
isset( $last_item->menu_order
) ) ? 1 +
$last_item->menu_order :
count( $menu_items );
} $original_parent = 0 <
$menu_item_db_id ?
get_post_field( 'post_parent',
$menu_item_db_id ) : 0;
if ( 'custom' ===
$args['menu-item-type'
] ) { // If custom menu item, trim the URL.
$args['menu-item-url'
] =
trim( $args['menu-item-url'
] );
} else { /*
* If non-custom menu item, then:
* - use the original object's URL.
* - blank default title to sync with the original object's title.
*/