diff --git a/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php b/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php index a0d3fe805d..d0333c61c4 100644 --- a/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php +++ b/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php @@ -270,6 +270,10 @@ class WP_REST_Posts_Controller extends WP_REST_Controller { $taxonomies = wp_list_filter( get_object_taxonomies( $this->post_type, 'objects' ), array( 'show_in_rest' => true ) ); + if ( ! empty( $request['tax_relation'] ) ) { + $query_args['tax_query'] = array( 'relation' => $request['tax_relation'] ); + } + foreach ( $taxonomies as $taxonomy ) { $base = ! empty( $taxonomy->rest_base ) ? $taxonomy->rest_base : $taxonomy->name; $tax_exclude = $base . '_exclude'; @@ -2531,6 +2535,14 @@ class WP_REST_Posts_Controller extends WP_REST_Controller { $taxonomies = wp_list_filter( get_object_taxonomies( $this->post_type, 'objects' ), array( 'show_in_rest' => true ) ); + if ( ! empty( $taxonomies ) ) { + $query_params['tax_relation'] = array( + 'description' => __( 'Limit result set based on relationship between multiple taxonomies.' ), + 'type' => 'string', + 'enum' => array( 'AND', 'OR' ), + ); + } + foreach ( $taxonomies as $taxonomy ) { $base = ! empty( $taxonomy->rest_base ) ? $taxonomy->rest_base : $taxonomy->name; diff --git a/wp-includes/version.php b/wp-includes/version.php index 530cc08646..c26f152664 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.4-alpha-46645'; +$wp_version = '5.4-alpha-46646'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.