diff --git a/wp-admin/admin-ajax.php b/wp-admin/admin-ajax.php index 7d05ab1cc7..3341fd6792 100644 --- a/wp-admin/admin-ajax.php +++ b/wp-admin/admin-ajax.php @@ -827,6 +827,8 @@ case 'add-menu-item' : $menu_id = (int) $_POST['menu']; if ( isset( $_POST['menu-item'] ) ) { $item_ids = wp_save_nav_menu_item( $menu_id, $_POST['menu-item'] ); + if ( is_wp_error( $item_ids ) ) + die('-1'); } else { $item_ids = array(); } diff --git a/wp-admin/includes/nav-menu.php b/wp-admin/includes/nav-menu.php index 6e1584c864..1914509615 100644 --- a/wp-admin/includes/nav-menu.php +++ b/wp-admin/includes/nav-menu.php @@ -808,7 +808,7 @@ function wp_nav_menu_item_taxonomy_meta_box( $object, $taxonomy ) { * * @param int $menu_id The menu ID for which to save this item. * @param array $menu_data The unsanitized posted menu item data. - * @return array The database IDs of the items saved. + * @return array The database IDs of the items saved */ function wp_save_nav_menu_item( $menu_id = 0, $menu_data = array() ) { $menu_id = (int) $menu_id; diff --git a/wp-admin/nav-menus.php b/wp-admin/nav-menus.php index d49fbe61ed..db0fcc9ca7 100644 --- a/wp-admin/nav-menus.php +++ b/wp-admin/nav-menus.php @@ -38,7 +38,7 @@ wp_enqueue_script( 'wp-lists' ); wp_enqueue_script( 'postbox' ); // Container for any messages displayed to the user -$messages_div = ''; +$messages = array(); // Container that stores the name of the active menu $nav_menu_selected_title = ''; @@ -169,7 +169,7 @@ switch ( $action ) { if ( is_nav_menu_item( $menu_item_id ) ) { if ( wp_delete_post( $menu_item_id, true ) ) { - $messages_div = '
' . __('The menu item has been successfully deleted.') . '
' . __('The menu item has been successfully deleted.') . '
' . $delete_nav_menu->get_error_message() . '
' . $delete_nav_menu->get_error_message() . '
' . __('The menu has been successfully deleted.') . '
' . __('The menu has been successfully deleted.') . '
' . $_nav_menu_selected_id->get_error_message() . '
' . $_nav_menu_selected_id->get_error_message() . '
' . sprintf( __('The %s menu has been successfully created.'), $nav_menu_selected_title ) . '
' . sprintf( __('The %s menu has been successfully created.'), $nav_menu_selected_title ) . '
' . __('Please enter a valid menu name.') . '
' . __('Please enter a valid menu name.') . '
' . $_nav_menu_selected_id->get_error_message() . '
' . $_nav_menu_selected_id->get_error_message() . '
' . $menu_item_db_id->get_error_message() . '
' . sprintf( __('The %s menu has been updated.'), $nav_menu_selected_title ) . '
' . sprintf( __('The %s menu has been updated.'), $nav_menu_selected_title ) . '
' . __('The current theme does not natively support menus, but you can use the “Navigation Menu” widget to add any menus you create here to the theme’s sidebar.') . '
' . __('The current theme does not natively support menus, but you can use the “Navigation Menu” widget to add any menus you create here to the theme’s sidebar.') . '
' . __('The current theme does not support menus.') . '
' . __('The current theme does not support menus.') . '