diff --git a/src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php b/src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php
index ee8af5b3ad..bab0ae8eae 100644
a
|
b
|
class WP_REST_Posts_Controller extends WP_REST_Controller { |
251 | 251 | } |
252 | 252 | } |
253 | 253 | |
254 | | // Force the post_type argument, since it's not a user input variable. |
255 | | $args['post_type'] = $this->post_type; |
256 | | |
257 | | /** |
258 | | * Filters the query arguments for a request. |
259 | | * |
260 | | * Enables adding extra arguments or setting defaults for a post collection request. |
261 | | * |
262 | | * @since 4.7.0 |
263 | | * |
264 | | * @link https://developer.wordpress.org/reference/classes/wp_query/ |
265 | | * |
266 | | * @param array $args Key value array of query var to query value. |
267 | | * @param WP_REST_Request $request The request used. |
268 | | */ |
269 | | $args = apply_filters( "rest_{$this->post_type}_query", $args, $request ); |
270 | | $query_args = $this->prepare_items_query( $args, $request ); |
271 | | |
272 | 254 | $taxonomies = wp_list_filter( get_object_taxonomies( $this->post_type, 'objects' ), array( 'show_in_rest' => true ) ); |
273 | 255 | |
274 | 256 | foreach ( $taxonomies as $taxonomy ) { |
… |
… |
class WP_REST_Posts_Controller extends WP_REST_Controller { |
276 | 258 | $tax_exclude = $base . '_exclude'; |
277 | 259 | |
278 | 260 | if ( ! empty( $request[ $base ] ) ) { |
279 | | $query_args['tax_query'][] = array( |
| 261 | $args['tax_query'][] = array( |
280 | 262 | 'taxonomy' => $taxonomy->name, |
281 | 263 | 'field' => 'term_id', |
282 | 264 | 'terms' => $request[ $base ], |
… |
… |
class WP_REST_Posts_Controller extends WP_REST_Controller { |
285 | 267 | } |
286 | 268 | |
287 | 269 | if ( ! empty( $request[ $tax_exclude ] ) ) { |
288 | | $query_args['tax_query'][] = array( |
| 270 | $args['tax_query'][] = array( |
289 | 271 | 'taxonomy' => $taxonomy->name, |
290 | 272 | 'field' => 'term_id', |
291 | 273 | 'terms' => $request[ $tax_exclude ], |
… |
… |
class WP_REST_Posts_Controller extends WP_REST_Controller { |
295 | 277 | } |
296 | 278 | } |
297 | 279 | |
| 280 | // Force the post_type argument, since it's not a user input variable. |
| 281 | $args['post_type'] = $this->post_type; |
| 282 | |
| 283 | /** |
| 284 | * Filters the query arguments for a request. |
| 285 | * |
| 286 | * Enables adding extra arguments or setting defaults for a post collection request. |
| 287 | * |
| 288 | * @since 4.7.0 |
| 289 | * |
| 290 | * @link https://developer.wordpress.org/reference/classes/wp_query/ |
| 291 | * |
| 292 | * @param array $args Key value array of query var to query value. |
| 293 | * @param WP_REST_Request $request The request used. |
| 294 | */ |
| 295 | $args = apply_filters( "rest_{$this->post_type}_query", $args, $request ); |
| 296 | $query_args = $this->prepare_items_query( $args, $request ); |
| 297 | |
298 | 298 | $posts_query = new WP_Query(); |
299 | 299 | $query_result = $posts_query->query( $query_args ); |
300 | 300 | |