Give menu items a default 'draft' state when added to the menu. props filosofo, fixes #13149
git-svn-id: http://svn.automattic.com/wordpress/trunk@14270 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
b42b1502e9
commit
560400fb26
|
@ -244,7 +244,6 @@ function wp_update_nav_menu_item( $menu_id = 0, $menu_item_db_id = 0, $menu_item
|
||||||
'post_content' => $args['menu-item-description'],
|
'post_content' => $args['menu-item-description'],
|
||||||
'post_excerpt' => $args['menu-item-attr-title'],
|
'post_excerpt' => $args['menu-item-attr-title'],
|
||||||
'post_parent' => $args['menu-item-parent-id'],
|
'post_parent' => $args['menu-item-parent-id'],
|
||||||
'post_status' => 'publish',
|
|
||||||
'post_title' => $args['menu-item-title'],
|
'post_title' => $args['menu-item-title'],
|
||||||
'post_type' => 'nav_menu_item',
|
'post_type' => 'nav_menu_item',
|
||||||
'tax_input' => array( 'nav_menu' => $menu->name ),
|
'tax_input' => array( 'nav_menu' => $menu->name ),
|
||||||
|
@ -253,11 +252,13 @@ function wp_update_nav_menu_item( $menu_id = 0, $menu_item_db_id = 0, $menu_item
|
||||||
// New menu item
|
// New menu item
|
||||||
if ( 0 == $menu_item_db_id ) {
|
if ( 0 == $menu_item_db_id ) {
|
||||||
$post['ID'] = 0;
|
$post['ID'] = 0;
|
||||||
|
$post['post_status'] = 'draft';
|
||||||
$menu_item_db_id = wp_insert_post( $post );
|
$menu_item_db_id = wp_insert_post( $post );
|
||||||
|
|
||||||
// Update existing menu item
|
// Update existing menu item
|
||||||
} else {
|
} else {
|
||||||
$post['ID'] = $menu_item_db_id;
|
$post['ID'] = $menu_item_db_id;
|
||||||
|
$post['post_status'] = 'publish';
|
||||||
wp_update_post( $post );
|
wp_update_post( $post );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue