Wordpress REST API _fields and _embed parameters are not working simultaneously
As answered previously, it would seem the _link is necessary to figure out how to get the _embed property. But if you're like me and want to really minimize the amount of JSON that is returned, you can do the following.
Suppose you want the wp:featuredmedia
property of _embedded
. Then you can request
OPTION 1
/wp/v2/pages?_embed=wp:featuredmedia&_fields=_links.wp:featuredmedia,_embedded
_embed => wp:featuredmedia
_fields => _embedded
and _links.wp:featuredmedia
(so that embedding will actually work)
OPTION 2: A slight variation that also works
/wp/v2/pages?_embed&_fields=_links.wp:featuredmedia,_embedded.wp:featuredmedia
_embed => tells us to do embedding
_fields => _links.wp:featuredmedia,_embedded.wp:featuredmedia
(ensures we only return those)