Hi svrooij,
I took a look into your code and debugged a bit on my test-site
it seems _embedded fields are not present in the
$data after this operation $data= $data->data;
so something happens here, of course the rest of code is not the problem.
If I call every endpoint (i.e. wp-json/wp/v2/posts/x) with the ?_embed, without using “fields” params the data are returned
and if i return $data in your plugin before that operation all fields are returned including _embedded
Also noticed that seems to miss the links information in fields
I.e. if I call a post endpoint (without _embed), for author’s field I obtain
“author”:[{“embeddable”:true,”href”:”http:\/\/mysite\/wp-json\/wp\/v2\/users\/2″}]
while if I filter using your plugin I obtain
“author”:2
So because the _embedded fields are based on _links and “embeddable” presence, I think this could be the point
I hope this help
-
This reply was modified 8 years, 2 months ago by
donachy.
-
This reply was modified 8 years, 2 months ago by
donachy.
-
This reply was modified 8 years, 2 months ago by
donachy.