Tell us what you are trying to do?
Once I set up the Custom Post Type to be exposed via the REST API I expect the associated Post Field Group fields to be exposed as well, but they are not.
I have been creating a custom plugin to expose fields as I add them, but this tedious.
(a) are you working on a solution for this?
(b) I'm happy to write a more generic plugin, but I didn't have any luck finding a function in the Codex for getting all the fields of a Custom Post Type. Clearly you know how to do this. Could you enlighten me or provide a snippet?
Is there any documentation that you are following?
No, could not find any.
Hello,
You are right, there isn't such a built-in feature within Types plugin, and it has been reported lots of time, for example:
https://toolset.com/forums/topic/rest-api-update-custom-fields/
https://toolset.com/forums/topic/exposing-custom-fields-through-rest-api/
https://toolset.com/forums/topic/how-to-get-custom-fields-into-the-rest-api-output/
We hope to include support for these in a future release, but I don't have an ETA for you right now. if you agree, we can mark this thread as a feature request, and let our team know it's important for you!
Thanks Luo, stellar support as always!
That stackexchange article has a link to https://wordpress.org/plugins/wp-rest-api-controller/ which appears to be the plugin I was looking to create, how awesome!
The other support links you provided were old, closed and contain many a "hidden link", so I figured I'd ask again. There seem to have been a lot of requests for this. For my needs the REST API Controller plugin does what I need. You may want to evaluate that and perhaps endorse/contribute to it.
If you do build this into Types I would expect to see a checkbox on the field create/edit UI where I can check a box to add it to REST. I would also hope for a PHP filter so I can transform the output for the field.
Thanks!
what's on the hidden link?
how to update custom fields using rest api?
I think it was a link to a Stack Exchange article. What you want is the plugin I referenced. It's actively maintained and allows you to add your custom fields to the REST API with a UI.
https://wordpress.org/plugins/wp-rest-api-controller/