WP-API/rest-filter

Why can't I filter by post_type 'listing-item' ?

Closed this issue · 2 comments

This is my request:
/wp-json/wp/v2/posts?filter[post_type]=listing-item

The posts endpoint only contains items of the post type; other custom post types each have their own endpoints, in this case you would probably want v2/listing-item (customizable using the rest_base option when registering the post type). There is unfortunately not currently a way to get posts of all different types using a single endpoint.

If you use auto discovery, the library will set you up a method to clear a listing items on its own – if you use auto discovery, the library will set you up a message to query listing items on its own – or else you can use registerRoute to make your own method. I will link you to the relevant documentation when I get back to my desk. Sorry to not have a better answer!

Deleted the other comment because I thought this was a different repo :D