diff --git a/src/wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php b/src/wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php
index ea2d0d1..95dc27b 100644
|
a
|
b
|
class WP_REST_Terms_Controller extends WP_REST_Controller {
|
| 159 | 159 | */ |
| 160 | 160 | public function get_items( $request ) { |
| 161 | 161 | |
| | 162 | // Check for taxonomy param. |
| | 163 | $taxonomy = isset( $request['taxonomy'] ) ? $request['taxonomy'] : $this->taxonomy; |
| | 164 | |
| | 165 | $taxonomy_obj = get_taxonomy( $taxonomy ); |
| | 166 | |
| | 167 | if ( false === $taxonomy_obj ) { |
| | 168 | return new WP_Error( 'invalid-taxonomy', sprintf( __( "Invalid '%s' taxonomy" ), $taxonomy ), array( 'status' => 405 ) ); |
| | 169 | } |
| | 170 | |
| | 171 | $this->taxonomy = $taxonomy; |
| | 172 | |
| 162 | 173 | // Retrieve the list of registered collection query parameters. |
| 163 | 174 | $registered = $this->get_collection_params(); |
| 164 | 175 | |
| … |
… |
class WP_REST_Terms_Controller extends WP_REST_Controller {
|
| 208 | 219 | $prepared_args['offset'] = ( $request['page'] - 1 ) * $prepared_args['number']; |
| 209 | 220 | } |
| 210 | 221 | |
| 211 | | $taxonomy_obj = get_taxonomy( $this->taxonomy ); |
| 212 | | |
| 213 | 222 | if ( $taxonomy_obj->hierarchical && isset( $registered['parent'], $request['parent'] ) ) { |
| 214 | 223 | if ( 0 === $request['parent'] ) { |
| 215 | 224 | // Only query top-level terms. |
| … |
… |
class WP_REST_Terms_Controller extends WP_REST_Controller {
|
| 985 | 994 | ), |
| 986 | 995 | ); |
| 987 | 996 | |
| | 997 | $query_params['taxonomy'] = array( |
| | 998 | 'description' => __( 'Taxonomy.' ), |
| | 999 | 'type' => 'string', |
| | 1000 | 'default' => null, |
| | 1001 | ); |
| | 1002 | |
| 988 | 1003 | /** |
| 989 | 1004 | * Filter collection parameters for the terms controller. |
| 990 | 1005 | * |
diff --git a/tests/phpunit/tests/rest-api/rest-tags-controller.php b/tests/phpunit/tests/rest-api/rest-tags-controller.php
index f2cd6a7..48026dd 100644
|
a
|
b
|
class WP_Test_REST_Tags_Controller extends WP_Test_REST_Controller_Testcase {
|
| 91 | 91 | 'post', |
| 92 | 92 | 'search', |
| 93 | 93 | 'slug', |
| | 94 | 'taxonomy', |
| 94 | 95 | ), $keys |
| 95 | 96 | ); |
| 96 | 97 | } |