These apis work perfectly.
http://domain.com/wp/api/get_tag_posts/?tag_slug=banana
http://domain.com/wp/api/get_category_posts/?category_slug=featured
Is there any way to join multiple tags or categories into a single request?
E.g.
http://domain.com/wp/api/get_category_posts/?category_slug=featured,news
or
http://domain.com/wp/api/get_category_posts/?category_slug=featured|news
I’m hoping to do what in SQL would be a “where category_name in (‘featured’,’news’)
You are after this
This is what you need to do in PHP to obtain multiple posts from multiple categories. Now in case you are also looking for json or xml or any format it spits out. Put a new function in functions.php and register it with
Call this in your theme or plugin and use action=getmyjson and url goes to admin_ajax with nonce set. After
Global $wpdb
you can use above function to bring all posts and then through them out as json object. Something like thisOnce this is all done. You will have multiple posts out put in json format.
I needed to do the same thing and ended up using this plugin
Query Multiple Taxonomies. This plugin lets you do faceted search using multiple custom taxonomies. (author’s description).
http://wordpress.org/extend/plugins/query-multiple-taxonomies/
It’s got a handy sidebar widget also. Hope this helps!
Have you tried making the category_name an array? e.g.
Also, with the tag, I found this example:
or