Skip to content

Commit

Permalink
Fix, coauthors API endpoint should be plural
Browse files Browse the repository at this point in the history
  • Loading branch information
douglas-johnson committed Oct 23, 2023
1 parent bb1b13b commit bfe1d86
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions php/api/endpoints/class-coauthors-controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -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<user_nicename>[\w-]+)',
'/coauthors/(?P<user_nicename>[\w-]+)',
array(
'args' => array(
'user_nicename' => array(
Expand Down
2 changes: 1 addition & 1 deletion php/blocks/class-blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
)
Expand Down

0 comments on commit bfe1d86

Please sign in to comment.