Closed ghost closed 8 years ago
Edit: I currently use the update_field() function of the ACF plugin to add manualy my custom field in the data response of the controller. Now, I can POST/PUT (create/update) my ACF fields with WP REST REST.
Réda.
@redacherifi hey great work! just curious, where do you use the update_field() function ? within WP-API or somewhere else ?
Cheers
@EugeneLiang It depends what type of object you will create/edit with REST. For example, if you want update an ACF field on your post, edit the /rest-api/lib/endpoints/class-wp-rest-posts-controller.php and add the ACF's function update_field() on the method prepare_item_for_database().
@redacherifi can this technique be used for creating acf fields too?
@EugeneLiang update_field() can only change the value of an existing field linked to a post/user... with its key/name. It supose you have already created your ACF field from the backoffice.
For more informations, check the doc : http://www.advancedcustomfields.com/resources/update_field
Hi,
First of all, very good work with this plugin Chris! I have read some topics about that but have you find a solution about how create a post in rest with their advanced custom field? Is it a WP REST API "problem" or can I fix it into your script?
Thx Réda.