I'm using the JSON Rest API plugin (https://wordpress.org/plugins/json-rest-api/). I have two custom taxonomies with one term each:
- Inner Part Categories
- Eye
- Symptoms Categories (Man)
- Broken Bone Single Fracture
I need to show posts that match both of these categories and terms. I've tried the following:
http://mcsc.hawkhorne.com/wp-json/posts?type=male-conditions&filter[taxonomy]=inner-part-categories&filter[term]=Eye&filter[taxonomy]=symptoms-categories-man&filter[term]=Broken%20Bone%20Single%20Fracture
But this method only returns the posts under the last declared taxonomy and term. For example, if I switch the tax and term around as such:
http://mcsc.hawkhorne.com/wp-json/posts?type=male-conditions&filter[taxonomy]=symptoms-categories-man&filter[term]=Broken%20Bone%20Single%20Fracture&filter[taxonomy]=inner-part-categories&filter[term]=Eye
It will then only show posts under the tax inner-part-categories and term Eye and ignore the first tax and term query.
I've been searching for hours and having found a solution.
I was also thinking maybe an array of sorts could be passed in the ajax data request, sort of how it's done in WP Query. I have the following code:
data: { filter: { 'posts_per_page': -1, 'post_status': 'publish', 'orderby': 'title', 'order': 'ASC' } },
Thanks for your help.
Aucun commentaire:
Enregistrer un commentaire