summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/jetpack/json-endpoints/class.wpcom-json-api-list-posts-endpoint.php')
-rw-r--r--plugins/jetpack/json-endpoints/class.wpcom-json-api-list-posts-endpoint.php17
1 files changed, 17 insertions, 0 deletions
diff --git a/plugins/jetpack/json-endpoints/class.wpcom-json-api-list-posts-endpoint.php b/plugins/jetpack/json-endpoints/class.wpcom-json-api-list-posts-endpoint.php
index 1ab369f0..db82ae9b 100644
--- a/plugins/jetpack/json-endpoints/class.wpcom-json-api-list-posts-endpoint.php
+++ b/plugins/jetpack/json-endpoints/class.wpcom-json-api-list-posts-endpoint.php
@@ -172,6 +172,23 @@ class WPCOM_JSON_API_List_Posts_Endpoint extends WPCOM_JSON_API_Post_Endpoint {
$query['tag'] = $args['tag'];
}
+ if ( ! empty( $args['term'] ) ) {
+ $query['tax_query'] = array();
+ foreach ( $args['term'] as $taxonomy => $slug ) {
+ $taxonomy_object = get_taxonomy( $taxonomy );
+ if ( false === $taxonomy_object || ( ! $taxonomy_object->public &&
+ ! current_user_can( $taxonomy_object->cap->assign_terms ) ) ) {
+ continue;
+ }
+
+ $query['tax_query'][] = array(
+ 'taxonomy' => $taxonomy,
+ 'field' => 'slug',
+ 'terms' => explode( ',', $slug )
+ );
+ }
+ }
+
if ( isset( $args['page'] ) ) {
if ( $args['page'] < 1 ) {
$args['page'] = 1;