From 4448936c97422691d7786b10695fd74e09956162 Mon Sep 17 00:00:00 2001 From: Mateus Machado Luna Date: Mon, 21 Oct 2019 17:22:10 -0300 Subject: [PATCH] Removes wp_query list params from item metadata GET endpoint, as they are not available there. #290. --- ...lass-tainacan-rest-item-metadata-controller.php | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/api/endpoints/class-tainacan-rest-item-metadata-controller.php b/src/api/endpoints/class-tainacan-rest-item-metadata-controller.php index 491e6b5ea..30cdef1f6 100644 --- a/src/api/endpoints/class-tainacan-rest-item-metadata-controller.php +++ b/src/api/endpoints/class-tainacan-rest-item-metadata-controller.php @@ -270,8 +270,8 @@ class REST_Item_Metadata_Controller extends REST_Controller { if($method === \WP_REST_Server::READABLE) { $endpoint_args = array_merge( - $endpoint_args, - parent::get_wp_query_params() + $endpoint_args, + $this->get_wp_query_params() ); } elseif ($method === \WP_REST_Server::EDITABLE) { $endpoint_args['values'] = [ @@ -295,7 +295,15 @@ class REST_Item_Metadata_Controller extends REST_Controller { * @return array */ public function get_wp_query_params() { - $query_params['context']['default'] = 'view'; + $query_params['context'] = array( + 'type' => 'string', + 'default' => 'view', + 'description' => 'The context in which the request is made.', + 'enum' => array( + 'view', + 'edit' + ), + ); return $query_params; }