Skip to content

Commit 6ac1368

Browse files
committed
Editor: Update the post editor preload paths for the DataForm inspector.
The DataForm-based inspector requests the form config of the post type on load, so preload `/wp/v2/view-config` with `_fields=form`. Remove the preload of the post author user, which was only requested by the previous author panel. See WordPress/gutenberg#85081. Developed in #14494. Reviewed by mamaduka. Merges [65772] to the 7.2 branch. Props ntsekouras, oandregal, mamaduka. Fixes #66339. git-svn-id: https://develop.svn.wordpress.org/branches/7.2@65778 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 58e7351 commit 6ac1368

1 file changed

Lines changed: 6 additions & 7 deletions

File tree

‎src/wp-admin/edit-form-blocks.php‎

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -121,15 +121,14 @@ static function ( $classes ) {
121121
'/wp/v2/templates/lookup?slug=front-page',
122122
'/wp/v2/taxonomies?context=edit',
123123
array( rest_get_route_for_post_type_items( $post_type ), 'OPTIONS' ),
124+
/*
125+
* The post summary of the inspector requests the form config of the post type
126+
* through `useViewConfig` with `fields: [ 'form' ]`, so the path must match
127+
* the resulting `_fields=form` request.
128+
*/
129+
'/wp/v2/view-config?kind=postType&name=' . $post_type . '&_fields=form',
124130
);
125131

126-
if ( post_type_supports( $post_type, 'author' ) && $post->post_author > 0 ) {
127-
$preload_paths[] = sprintf(
128-
'/wp/v2/users/%d?context=view&_fields=id,name',
129-
(int) $post->post_author
130-
);
131-
}
132-
133132
block_editor_rest_api_preload( $preload_paths, $block_editor_context );
134133

135134
wp_add_inline_script(

0 commit comments

Comments
 (0)