From 13d3c5ee0821ab6b8a8c91ff88f79a829e85de7f Mon Sep 17 00:00:00 2001 From: George Mamadashvili Date: Fri, 16 Aug 2024 06:21:43 +0000 Subject: [PATCH] Editor: Fix preloaded REST API paths When providing an incorrect path to preload, the `rest_preload_api_request` will silently fail, and nothing will be preloaded. * Fix typo for `wp_template_part` post type preload path for the Site Editor. * Do not preload the `wp_block` post type for post editors. The endpoint doesn't support unbound queries, and the data is no longer needed during editor initialization. Props kirasong, tyxla, mamaduka. Fixes #61884. git-svn-id: https://develop.svn.wordpress.org/trunk@58904 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/edit-form-blocks.php | 7 ------- src/wp-admin/site-editor.php | 2 +- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/src/wp-admin/edit-form-blocks.php b/src/wp-admin/edit-form-blocks.php index ecf83f2017..91e4b1e37d 100644 --- a/src/wp-admin/edit-form-blocks.php +++ b/src/wp-admin/edit-form-blocks.php @@ -55,13 +55,6 @@ $rest_path = rest_get_route_for_post( $post ); $preload_paths = array( '/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', diff --git a/src/wp-admin/site-editor.php b/src/wp-admin/site-editor.php index 70d646ae51..6951d05e55 100644 --- a/src/wp-admin/site-editor.php +++ b/src/wp-admin/site-editor.php @@ -91,7 +91,7 @@ $preload_paths = array( array( '/wp/v2/media', 'OPTIONS' ), '/wp/v2/types?context=view', '/wp/v2/types/wp_template?context=edit', - '/wp/v2/types/wp_template-part?context=edit', + '/wp/v2/types/wp_template_part?context=edit', '/wp/v2/templates?context=edit&per_page=-1', '/wp/v2/template-parts?context=edit&per_page=-1', '/wp/v2/themes?context=edit&status=active',