From bfe1d86561997b8d0de49c8391803e3a25c7679b Mon Sep 17 00:00:00 2001 From: Douglas Johnson Date: Thu, 28 Sep 2023 10:08:17 -0400 Subject: [PATCH] Fix, coauthors API endpoint should be plural --- README.md | 2 +- php/api/endpoints/class-coauthors-controller.php | 4 ++-- php/blocks/class-blocks.php | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index f8fa8617..d9d4004d 100644 --- a/README.md +++ b/README.md @@ -143,7 +143,7 @@ Example: ## Block Example Data -When working with Full Site Editing, or in the post editor before the authors are loaded, example data is used. The example data provided with the co-author blocks resembles a response to the `/coauthors/v1/coauthor/:user-nicename` REST API endpoint. +When working with Full Site Editing, or in the post editor before the authors are loaded, example data is used. The example data provided with the co-author blocks resembles a response to the `/coauthors/v1/coauthors/:user-nicename` REST API endpoint. ### Extending diff --git a/php/api/endpoints/class-coauthors-controller.php b/php/api/endpoints/class-coauthors-controller.php index a12792c1..1c9da7f4 100644 --- a/php/api/endpoints/class-coauthors-controller.php +++ b/php/api/endpoints/class-coauthors-controller.php @@ -93,14 +93,14 @@ public function register_coauthors_route(): void { * * Provide a user nicename as a hyphen-separated string to retrieve a single co-author. * - * Example: `/wp-json/coauthors/v1/coauthor/user-nicename` + * Example: `/wp-json/coauthors/v1/coauthors/user-nicename` * * @since 3.6.0 */ public function register_coauthor_route(): void { register_rest_route( 'coauthors/v1', - '/coauthor/(?P[\w-]+)', + '/coauthors/(?P[\w-]+)', array( 'args' => array( 'user_nicename' => array( diff --git a/php/blocks/class-blocks.php b/php/blocks/class-blocks.php index 7ae243d7..2a5c7a61 100644 --- a/php/blocks/class-blocks.php +++ b/php/blocks/class-blocks.php @@ -173,7 +173,7 @@ public static function get_author_with_api_schema( $author ): ?array { WP_REST_Request::from_url( home_url( sprintf( - '/wp-json/coauthors/v1/coauthor/%s', + '/wp-json/coauthors/v1/coauthors/%s', $author->user_nicename ) )