Skip to content

Commit e13b7cb

Browse files
committed
Editor: Update preloaded paths for the site editor
Add the `OPTIONS /wp/v2/pages` route to the list. The request is made via the `useBlockEditorSettings` hook at the top of the editor React tree. Preloading should improve the editor's loading time. Avoid hardcoding paths for the 'attachment' post type; use the `rest_get_route_for_post_type_items` helper method instead. Props mamaduka, noisysocks. See #61884. git-svn-id: https://develop.svn.wordpress.org/trunk@58984 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 9ad162e commit e13b7cb

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/wp-admin/site-editor.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@ static function ( $classes ) {
8888
);
8989

9090
$preload_paths = array(
91-
array( '/wp/v2/media', 'OPTIONS' ),
91+
array( rest_get_route_for_post_type_items( 'attachment' ), 'OPTIONS' ),
92+
array( rest_get_route_for_post_type_items( 'page' ), 'OPTIONS' ),
9293
'/wp/v2/types?context=view',
9394
'/wp/v2/types/wp_template?context=edit',
9495
'/wp/v2/types/wp_template_part?context=edit',

0 commit comments

Comments
 (0)