From cc0ec8e72ae4a22e53cc25ce22316e82d3694f0f Mon Sep 17 00:00:00 2001 From: Tonya Mork Date: Tue, 7 Dec 2021 16:13:54 +0000 Subject: [PATCH] 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 --- src/wp-admin/site-editor.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wp-admin/site-editor.php b/src/wp-admin/site-editor.php index d135a0ebf2..64abbdb0cd 100644 --- a/src/wp-admin/site-editor.php +++ b/src/wp-admin/site-editor.php @@ -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 );