Skip to content

Commit 3371eed

Browse files
authored
Remove misleading method parameter for get_item_schema
Removed $request param from get_item_schema() since this function does not actually support parameters when used in the WP_REST_Posts_Controller class. Including the param here is misleading since it is not needed, even in this custom controller. If the reader uses this example with the WP_REST_Posts_Controller class, an error will occur. Fixes #106.
1 parent 48e6469 commit 3371eed

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

extending-the-rest-api/controller-classes.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -194,9 +194,9 @@ class My_REST_Posts_Controller {
194194
/**
195195
* Get our sample schema for a post.
196196
*
197-
* @param WP_REST_Request $request Current request.
197+
* @return array The sample schema for a post
198198
*/
199-
public function get_item_schema( $request ) {
199+
public function get_item_schema() {
200200
if ( $this->schema ) {
201201
// Since WordPress 5.3, the schema can be cached in the $schema property.
202202
return $this->schema;

0 commit comments

Comments
 (0)