wp-net / WordPressPCL

This is a portable library for consuimg the WordPress REST-API in (almost) any C# application
MIT License
338 stars 129 forks source link

How to get objects by post type or taxonomy #176

Closed rubenTDV closed 4 years ago

rubenTDV commented 5 years ago

I'm trying to get the objects with a specific post type or taxonomy, not a entire page, nor a post from a blog, only the website objects that have an specific post type.

For example, in my web site I have a "news" post type with "rutes" and "metereology" taxonomies, but I don´t know how to extract those objects.

Thanks!!

ThomasPe commented 5 years ago

Although it's not documented in the official REST API Handbook it seems it's possible to filter posts by custom taxonomies like this: https://www.timrosswebdevelopment.com/filter-wordpress-rest-api-by-taxonomy-slug/

So you could try to use the CustomRequest method and manually specify the correct REST path: https://github.com/wp-net/WordPressPCL/wiki/CustomRequest

Hope this helps.