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
This commit is contained in:
George Mamadashvili 2024-08-16 06:21:43 +00:00
parent aa9fd3315c
commit 13d3c5ee08
2 changed files with 1 additions and 8 deletions

View File

@ -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',

View File

@ -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',