It seems that if you use _fields
in an API request also containing _embed
, the _fields
filter will filter out all embeds.
The following request:
domain.com/wp-json/wp/v2/posts?_fields=link,title&_embed=wp:featuredmedia
has no _embedded
field, but it comes back if I remove the _fields
filter. I also tried passing _fields=link,title,_embedded
, but it doesn’t work either.
It is not clear in the documentation, but you need to include the “_links” and “_embedded” as fields to be returned. In addition, I include the _embed parameter, as it does not require a value. As of WordPress 5.4, the resources to embed can be limited by passing a list of link relation names to the _embed parameter, though I have not had success with that when using _fields
Example:
domain.com/wp-json/wp/v2/posts?_fields=link,title,featured_media,_links,_embedded&_embed