diff --git a/wp-admin/admin-ajax.php b/wp-admin/admin-ajax.php index 954eae3b3c..09cc4e3945 100644 --- a/wp-admin/admin-ajax.php +++ b/wp-admin/admin-ajax.php @@ -816,14 +816,9 @@ case 'add-menu-item' : require_once ABSPATH . 'wp-admin/includes/nav-menu.php'; - $menu_id = (int) $_POST['menu']; - if ( isset( $_POST['menu-item'] ) ) { - $item_ids = wp_save_nav_menu_items( $menu_id, $_POST['menu-item'] ); - if ( is_wp_error( $item_ids ) ) - die('-1'); - } else { - $item_ids = array(); - } + $item_ids = wp_save_nav_menu_items( 0, $_POST['menu-item'] ); + if ( is_wp_error( $item_ids ) ) + die('-1'); foreach ( (array) $item_ids as $menu_item_id ) { $menu_obj = get_post( $menu_item_id ); diff --git a/wp-admin/includes/nav-menu.php b/wp-admin/includes/nav-menu.php index bff7e368d7..6fbf9eb56a 100644 --- a/wp-admin/includes/nav-menu.php +++ b/wp-admin/includes/nav-menu.php @@ -58,11 +58,26 @@ class Walker_Nav_Menu_Edit extends Walker_Nav_Menu { $original_object = get_post( $item->object_id ); $original_title = $original_object->post_title; } + + $classes = array( + 'menu-item menu-item-depth-' . $depth, + 'menu-item-' . esc_attr( $item->object ), + 'menu-item-edit-' . ( ( isset( $_GET['edit-menu-item'] ) && $item_id == $_GET['edit-menu-item'] ) ? 'active' : 'inactive'), + ); + + $title = $item->title; + + if ( isset( $item->post_status ) && 'draft' == $item->post_status ) { + $classes[] = 'pending'; + /* translators: %s: title of menu item in draft status */ + $title = sprintf( __('%s (Pending)'), $item->title ); + } + ?> -