I am trying to retrieve posts from multiple post types using WP REST API. I have no problem getting a feed from one post type book by doing this:
http://example.com/wp-json/posts?type=book&filter[posts_per_page]=10
Now I want to extend the feed to get book and movie. This only gives me the last specified type:
http://example.com/wp-json/posts?type=book&type=movie&filter[posts_per_page]=10
This gives me an error:
http://example.com/wp-json/posts?type[]=book&type[]=movie&filter[posts_per_page]=10
How should I be handling this?
Thanks!
Edit: Fixed syntax to match what I actually have. Here are the errors that I get when this syntax http://example.com/wp-json/posts?type[]=book&type[]=movie&filter[posts_per_page]=10 is used:
Warning: urlencode() expects parameter 1 to be string, array given in /home/newbreak/public_html/wp-includes/formatting.php on line 4128
Warning: Cannot modify header information - headers already sent by (output started at /home/newbreak/public_html/wp-includes/formatting.php:4128) in /home/newbreak/public_html/wp-content/plugins/json-rest-api/lib/class-wp-json-server.php on line 587
Warning: Cannot modify header information - headers already sent by (output started at /home/newbreak/public_html/wp-includes/formatting.php:4128) in /home/newbreak/public_html/wp-content/plugins/json-rest-api/lib/class-wp-json-server.php on line 587
Warning: Cannot modify header information - headers already sent by (output started at /home/newbreak/public_html/wp-includes/formatting.php:4128) in /home/newbreak/public_html/wp-content/plugins/json-rest-api/lib/class-wp-json-server.php on line 587
Warning: Cannot modify header information - headers already sent by (output started at /home/newbreak/public_html/wp-includes/formatting.php:4128) in /home/newbreak/public_html/wp-content/plugins/json-rest-api/lib/class-wp-json-server.php on line 587
Warning: Cannot modify header information - headers already sent by (output started at /home/newbreak/public_html/wp-includes/formatting.php:4128) in /home/newbreak/public_html/wp-content/plugins/json-rest-api/lib/class-wp-json-server.php on line 587
Warning: Cannot modify header information - headers already sent by (output started at /home/newbreak/public_html/wp-includes/formatting.php:4128) in /home/newbreak/public_html/wp-content/plugins/json-rest-api/lib/class-wp-json-server.php on line 587
I only get the errors when I send the type as an array type[].
typewithpost_type?