diff --git a/wp-includes/nav-menu.php b/wp-includes/nav-menu.php index 8fceeb750e..c289c2c916 100644 --- a/wp-includes/nav-menu.php +++ b/wp-includes/nav-menu.php @@ -406,11 +406,10 @@ function wp_update_nav_menu_object( $menu_id = 0, $menu_data = array() ) { /** * Save the properties of a menu item or create a new one. * - * The menu-item-title, menu-item-description, menu-item-attr-title, and menu-item-content are expected + * The menu-item-title, menu-item-description and menu-item-attr-title are expected * to be pre-slashed since they are passed directly to APIs that expect slashed data. * * @since 3.0.0 - * @since 5.9.0 Added the menu-item-content parameter. * * @param int $menu_id The ID of the menu. Required. If "0", makes the menu item a draft orphan. * @param int $menu_item_db_id The ID of the menu item. If "0", creates a new menu item. @@ -449,7 +448,6 @@ function wp_update_nav_menu_item( $menu_id = 0, $menu_item_db_id = 0, $menu_item 'menu-item-attr-title' => '', 'menu-item-target' => '', 'menu-item-classes' => '', - 'menu-item-content' => '', 'menu-item-xfn' => '', 'menu-item-status' => '', 'menu-item-post-date' => '', @@ -574,7 +572,6 @@ function wp_update_nav_menu_item( $menu_id = 0, $menu_item_db_id = 0, $menu_item update_post_meta( $menu_item_db_id, '_menu_item_classes', $args['menu-item-classes'] ); update_post_meta( $menu_item_db_id, '_menu_item_xfn', $args['menu-item-xfn'] ); update_post_meta( $menu_item_db_id, '_menu_item_url', esc_url_raw( $args['menu-item-url'] ) ); - update_post_meta( $menu_item_db_id, '_menu_item_content', $args['menu-item-content'] ); if ( 0 == $menu_id ) { update_post_meta( $menu_item_db_id, '_menu_item_orphaned', (string) time() ); @@ -913,10 +910,6 @@ function wp_setup_nav_menu_item( $menu_item ) { $menu_item->title = ( '' === $menu_item->post_title ) ? $original_title : $menu_item->post_title; - } elseif ( 'block' === $menu_item->type ) { - $menu_item->type_label = __( 'Block' ); - $menu_item->title = $menu_item->post_title; - $menu_item->menu_item_content = ! isset( $menu_item->menu_item_content ) ? get_post_meta( $menu_item->ID, '_menu_item_content', true ) : $menu_item->menu_item_content; } else { $menu_item->type_label = __( 'Custom Link' ); $menu_item->title = $menu_item->post_title; diff --git a/wp-includes/rest-api/endpoints/class-wp-rest-menu-items-controller.php b/wp-includes/rest-api/endpoints/class-wp-rest-menu-items-controller.php index a461a937e5..7a96e0a425 100644 --- a/wp-includes/rest-api/endpoints/class-wp-rest-menu-items-controller.php +++ b/wp-includes/rest-api/endpoints/class-wp-rest-menu-items-controller.php @@ -339,7 +339,6 @@ class WP_REST_Menu_Items_Controller extends WP_REST_Posts_Controller { 'menu-item-title' => $menu_item_obj->title, 'menu-item-url' => $menu_item_obj->url, 'menu-item-description' => $menu_item_obj->description, - 'menu-item-content' => $menu_item_obj->menu_item_content, 'menu-item-attr-title' => $menu_item_obj->attr_title, 'menu-item-target' => $menu_item_obj->target, 'menu-item-classes' => $menu_item_obj->classes, @@ -360,7 +359,6 @@ class WP_REST_Menu_Items_Controller extends WP_REST_Posts_Controller { 'menu-item-title' => '', 'menu-item-url' => '', 'menu-item-description' => '', - 'menu-item-content' => '', 'menu-item-attr-title' => '', 'menu-item-target' => '', 'menu-item-classes' => array(), @@ -409,15 +407,6 @@ class WP_REST_Menu_Items_Controller extends WP_REST_Posts_Controller { } } - // Nav menu content. - if ( ! empty( $schema['properties']['content'] ) && isset( $request['content'] ) ) { - if ( is_string( $request['content'] ) ) { - $prepared_nav_item['menu-item-content'] = $request['content']; - } elseif ( isset( $request['content']['raw'] ) ) { - $prepared_nav_item['menu-item-content'] = $request['content']['raw']; - } - } - $error = new WP_Error(); // Check if object id exists before saving. @@ -460,11 +449,6 @@ class WP_REST_Menu_Items_Controller extends WP_REST_Posts_Controller { } } - // If menu item is type block, then content is required. - if ( 'block' === $prepared_nav_item['menu-item-type'] && empty( $prepared_nav_item['menu-item-content'] ) ) { - $error->add( 'rest_content_required', __( 'The content is required when using a block menu item type.' ), array( 'status' => 400 ) ); - } - if ( $error->has_errors() ) { return $error; } @@ -566,23 +550,6 @@ class WP_REST_Menu_Items_Controller extends WP_REST_Posts_Controller { $data['object_id'] = absint( $menu_item->object_id ); } - if ( rest_is_field_included( 'content', $fields ) ) { - $data['content'] = array(); - } - - if ( rest_is_field_included( 'content.raw', $fields ) ) { - $data['content']['raw'] = $menu_item->menu_item_content; - } - - if ( rest_is_field_included( 'content.rendered', $fields ) ) { - /** This filter is documented in wp-includes/post-template.php */ - $data['content']['rendered'] = apply_filters( 'the_content', $menu_item->menu_item_content ); - } - - if ( rest_is_field_included( 'content.block_version', $fields ) ) { - $data['content']['block_version'] = block_version( $menu_item->menu_item_content ); - } - if ( rest_is_field_included( 'parent', $fields ) ) { // Same as post_parent, exposed as an integer. $data['parent'] = (int) $menu_item->menu_item_parent; @@ -781,7 +748,7 @@ class WP_REST_Menu_Items_Controller extends WP_REST_Posts_Controller { $schema['properties']['type'] = array( 'description' => __( 'The family of objects originally represented, such as "post_type" or "taxonomy".' ), 'type' => 'string', - 'enum' => array( 'taxonomy', 'post_type', 'post_type_archive', 'custom', 'block' ), + 'enum' => array( 'taxonomy', 'post_type', 'post_type_archive', 'custom' ), 'context' => array( 'view', 'edit', 'embed' ), 'default' => 'custom', ); @@ -859,31 +826,6 @@ class WP_REST_Menu_Items_Controller extends WP_REST_Posts_Controller { 'default' => 0, ); - $schema['properties']['content'] = array( - 'description' => __( 'HTML content to display for this block menu item.' ), - 'context' => array( 'view', 'edit', 'embed' ), - 'type' => array( 'string', 'object' ), - 'properties' => array( - 'raw' => array( - 'description' => __( 'HTML content, as it exists in the database.' ), - 'type' => 'string', - 'context' => array( 'edit' ), - ), - 'rendered' => array( - 'description' => __( 'HTML content, transformed for display.' ), - 'type' => 'string', - 'context' => array( 'view', 'edit' ), - 'readonly' => true, - ), - 'block_version' => array( - 'description' => __( 'Version of the block format used in the HTML content.' ), - 'type' => 'integer', - 'context' => array( 'edit' ), - 'readonly' => true, - ), - ), - ); - $schema['properties']['target'] = array( 'description' => __( 'The target attribute of the link element for this menu item.' ), 'type' => 'string', diff --git a/wp-includes/version.php b/wp-includes/version.php index 34c8ecfb1f..b48a2a638a 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '5.9-alpha-52183'; +$wp_version = '5.9-alpha-52184'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.