I needed to sort the custom posts in a REST API response by a meta value, this is how I did it.
Tag: REST API
How to filter WordPress REST API for custom post type by taxonomy slug
I spent ages looking for an answer to my question of how to implement this, I knew that it was possible but I couldn’t seem to find the right answer anywhere. So I’m posting it here for my future reference and in case anyone else finds it.
Continue reading "How to filter WordPress REST API for custom post type by taxonomy slug"
WordPress REST API post orderby custom value
Ordering posts by menu_order doesn’t work out of the box with the WP REST API. To enable this you need to add a filter to rest_{post_type}_collection_params
for each post type you want to order by menu_order.
Continue reading "WordPress REST API post orderby custom value"