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.
Built from https://develop.svn.wordpress.org/trunk@58904


git-svn-id: http://core.svn.wordpress.org/trunk@58300 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Mamaduka 2024-08-16 06:23:17 +00:00
parent af61bf819e
commit bfcd875946
3 changed files with 2 additions and 9 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',

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.7-alpha-58903';
$wp_version = '6.7-alpha-58904';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.