wp query – How to iterate _fields parameter in custom REST api endpoint

I am trying to fetch additional fields in wp/v2 namespace using post endpoint. How do I replicate the _fields property to get wp:conditions for access to the featured image and what not and all the stuff that doesn’t come with get_posts / WP_Query right away? Here is my sample logic for the data I want:


I’m not sure how to add this functionality to my custom function.

Leave a Comment