REST API: Pass post type name to rest_get_route_for_post_type_items().

The new `rest_get_route_for_post_type_items()` function accepts a string, not an object. This commit passes the post type name instead of the object to resolve a notice in the site editor page.

Follow-up to [52281].

Props walbo.
Fixes #54536.

git-svn-id: https://develop.svn.wordpress.org/trunk@52333 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Tonya Mork 2021-12-07 16:13:54 +00:00
parent ba518c2d86
commit cc0ec8e72a

View File

@ -64,7 +64,7 @@ if ( isset( $_GET['postType'] ) && ! isset( $_GET['postId'] ) ) {
'/',
'/wp/v2/types/' . $post_type->name . '?context=edit',
'/wp/v2/types?context=edit',
add_query_arg( 'context', 'edit', rest_get_route_for_post_type_items( $post_type ) ),
add_query_arg( 'context', 'edit', rest_get_route_for_post_type_items( $post_type->name ) ),
);
block_editor_rest_api_preload( $preload_paths, $block_editor_context );