From f032643f44d243622dcb9f13ae8637306bc572d7 Mon Sep 17 00:00:00 2001 From: Jarda Snajdr Date: Thu, 7 Apr 2022 14:29:59 +0200 Subject: [PATCH] Update preload paths for post, site and widgets editors --- src/wp-admin/edit-form-blocks.php | 13 ++++++++++--- src/wp-admin/site-editor.php | 8 +------- src/wp-admin/widgets-form-blocks.php | 1 + 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/wp-admin/edit-form-blocks.php b/src/wp-admin/edit-form-blocks.php index e26ae1af6f95e..eb422b5280f90 100644 --- a/src/wp-admin/edit-form-blocks.php +++ b/src/wp-admin/edit-form-blocks.php @@ -57,13 +57,20 @@ static function( $classes ) { // 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/src/wp-admin/site-editor.php b/src/wp-admin/site-editor.php index f9d2605b23ff5..80976bb4b408a 100644 --- a/src/wp-admin/site-editor.php +++ b/src/wp-admin/site-editor.php @@ -72,17 +72,11 @@ static function( $classes ) { $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/src/wp-admin/widgets-form-blocks.php b/src/wp-admin/widgets-form-blocks.php index ee3cb37734d3b..b4c6dd28d4e92 100644 --- a/src/wp-admin/widgets-form-blocks.php +++ b/src/wp-admin/widgets-form-blocks.php @@ -19,6 +19,7 @@ $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', );