From 358dd334a401ae07f7359221d658692960370260 Mon Sep 17 00:00:00 2001 From: gziolo Date: Thu, 7 Apr 2022 13:40:04 +0000 Subject: [PATCH] Editor: Update preload paths for post, site and widgets editors Changes the REST endpoints that get preloaded when displaying a page for post, site and widgets editor, so that they are in sync with what the latest version of Gutenberg to be shipped with Core 6.0 really requests. Props jsnajdr. See #55505. Built from https://develop.svn.wordpress.org/trunk@53094 git-svn-id: http://core.svn.wordpress.org/trunk@52683 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/edit-form-blocks.php | 13 ++++++++++--- wp-admin/site-editor.php | 8 +------- wp-admin/widgets-form-blocks.php | 1 + wp-includes/version.php | 2 +- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/wp-admin/edit-form-blocks.php b/wp-admin/edit-form-blocks.php index e26ae1af6f..eb422b5280 100644 --- a/wp-admin/edit-form-blocks.php +++ b/wp-admin/edit-form-blocks.php @@ -57,13 +57,20 @@ $rest_path = rest_get_route_for_post( $post ); // Preload common data. $preload_paths = array( - '/wp/v2/types?context=edit', - '/wp/v2/taxonomies?context=edit', - '/wp/v2/themes?status=active', + '/wp/v2/types?context=view', + '/wp/v2/taxonomies?context=view', + add_query_arg( + array( + 'context' => 'edit', + 'per_page' => -1, + ), + rest_get_route_for_post_type_items( 'wp_block' ) + ), add_query_arg( 'context', 'edit', $rest_path ), sprintf( '/wp/v2/types/%s?context=edit', $post_type ), '/wp/v2/users/me', array( rest_get_route_for_post_type_items( 'attachment' ), 'OPTIONS' ), + array( rest_get_route_for_post_type_items( 'page' ), 'OPTIONS' ), array( rest_get_route_for_post_type_items( 'wp_block' ), 'OPTIONS' ), sprintf( '%s/autosaves?context=edit', $rest_path ), '/wp/v2/settings', diff --git a/wp-admin/site-editor.php b/wp-admin/site-editor.php index 66b07d915a..8e651979e9 100644 --- a/wp-admin/site-editor.php +++ b/wp-admin/site-editor.php @@ -87,17 +87,11 @@ $active_global_styles_id = WP_Theme_JSON_Resolver::get_user_global_styles_post_i $active_theme = wp_get_theme()->get_stylesheet(); $preload_paths = array( array( '/wp/v2/media', 'OPTIONS' ), - '/wp/v2/types?context=edit', + '/wp/v2/types?context=view', '/wp/v2/types/wp_template?context=edit', '/wp/v2/types/wp_template-part?context=edit', - '/wp/v2/taxonomies?context=edit', - '/wp/v2/pages?context=edit', - '/wp/v2/categories?context=edit', - '/wp/v2/posts?context=edit', - '/wp/v2/tags?context=edit', '/wp/v2/templates?context=edit&per_page=-1', '/wp/v2/template-parts?context=edit&per_page=-1', - '/wp/v2/settings', '/wp/v2/themes?context=edit&status=active', '/wp/v2/global-styles/' . $active_global_styles_id . '?context=edit', '/wp/v2/global-styles/' . $active_global_styles_id, diff --git a/wp-admin/widgets-form-blocks.php b/wp-admin/widgets-form-blocks.php index ee3cb37734..b4c6dd28d4 100644 --- a/wp-admin/widgets-form-blocks.php +++ b/wp-admin/widgets-form-blocks.php @@ -19,6 +19,7 @@ $block_editor_context = new WP_Block_Editor_Context( array( 'name' => 'core/edit $preload_paths = array( array( rest_get_route_for_post_type_items( 'attachment' ), 'OPTIONS' ), + '/wp/v2/widget-types?context=edit&per_page=-1', '/wp/v2/sidebars?context=edit&per_page=-1', '/wp/v2/widgets?context=edit&per_page=-1&_embed=about', ); diff --git a/wp-includes/version.php b/wp-includes/version.php index 3f6e015d2b..597f2d1709 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.0-alpha-53093'; +$wp_version = '6.0-alpha-53094'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.