Reputation: 87
I try to use wordpress API to build my back-office more easy. For this I must make relation between CPT UI post. I use the ACF and ACF recursive plugin for help me in this. But in the json 'http://localhost:10018/wp-json/wp/v2/plays' for example, i don't have the custom field ACF in my relation...
In this example i linked roles to the play and i want to have the ACF field for this item from staff post type.
I tried all the solutions in this topic : https://github.com/airesvsg/acf-to-rest-api/issues/223 But nothings happen...
Any idea ?
Upvotes: 1
Views: 738
Reputation: 2031
Depending on your setup, one of these should work now days. Seems to be a built in feature.
https://example.com/wp/?rest_route=/wp/v2/posts&_fields=title,acf
https://example.com/wp-json/wp/v2/posts?_fields=title,acf
The important bit being, adding acf
to the list of fields and you should get an array of all the acf fields.
There is more info here about which approach above might be appropriate for your situation.
Upvotes: 0