diff --git a/wp-admin/admin-ajax.php b/wp-admin/admin-ajax.php index 954221c36..81ce66e8a 100644 --- a/wp-admin/admin-ajax.php +++ b/wp-admin/admin-ajax.php @@ -743,10 +743,9 @@ case 'add-menu-item' : require_once ABSPATH . 'wp-admin/includes/nav-menu.php'; - /** - * For performance reasons, we omit some object properties from the checklist. - * The following is a hacky way to restore them when adding non-custom items. - */ + // For performance reasons, we omit some object properties from the checklist. + // The following is a hacky way to restore them when adding non-custom items. + $menu_items_data = (array) $_POST['menu-item']; $menu_item_data = array_shift( $menu_items_data ); if ( @@ -767,12 +766,12 @@ case 'add-menu-item' : $_menu_items = array_map( 'wp_setup_nav_menu_item', array( $_object ) ); $_menu_item = array_shift( $_menu_items ); - /** Restore the missing menu item properties **/ + // Restore the missing menu item properties $menu_item_data['menu-item-description'] = $_menu_item->description; - - $menu_items_data = array( $menu_item_data ); } + $menu_items_data = array( $menu_item_data ); + $item_ids = wp_save_nav_menu_items( 0, $menu_items_data ); if ( is_wp_error( $item_ids ) ) die('-1'); diff --git a/wp-includes/post.php b/wp-includes/post.php index fb1582b6a..a1ea2e328 100644 --- a/wp-includes/post.php +++ b/wp-includes/post.php @@ -3097,6 +3097,7 @@ function &get_page(&$page, $output = OBJECT, $filter = 'raw') { */ function get_page_by_path($page_path, $output = OBJECT, $post_type = 'page') { global $wpdb; + $null = null; $page_path = rawurlencode(urldecode($page_path)); $page_path = str_replace('%2F', '/', $page_path); $page_path = str_replace('%20', ' ', $page_path); @@ -3110,7 +3111,7 @@ function get_page_by_path($page_path, $output = OBJECT, $post_type = 'page') { $pages = $wpdb->get_results( $wpdb->prepare( "SELECT ID, post_name, post_parent FROM $wpdb->posts WHERE post_name = %s AND (post_type = %s OR post_type = 'attachment')", $leaf_path, $post_type )); if ( empty($pages) ) - return null; + return $null; foreach ( $pages as $page ) { $path = '/' . $leaf_path; @@ -3124,7 +3125,7 @@ function get_page_by_path($page_path, $output = OBJECT, $post_type = 'page') { return get_page($page->ID, $output, $post_type); } - return null; + return $null; } /**