Update ACF fields inside layout via WP API

喜欢而已 提交于 2021-02-07 10:23:59

问题


I am trying to update a custom field via the WordPress API. The custom field is within an Advanced Custom Fields repeating layout and I cannot figure out how to update it.

I have authentication set up and can update a post status, but I'm not having any luck in updating the ACF data.

Using Postman : Page status can be updated with http://localhost:9000/wp-json/wp/v2/pages/4564/?status=public. Is there a similar value which can be used to update the ACF field or a way to update by passing JSON instead?

{
    "id": 4564,
     ...
    "acf": {
        "insert_to_head": "",
        "insert_to_foot": "",
        "Layout": [
            {
                "acf_fc_layout": "cert_challenge_pin",
                "challenge_pin": "0527881"
            }]
}

The ACF to REST API plugin is in use and fields can be viewed via the API but not updated.

Having exhausted search and documentation, any help would be greatly appreciated!

screenshot from postman


回答1:


I found from this post that you should use the key fields instead of acf. In addition, I had to send a Content-type: application/json header to get it working.



来源:https://stackoverflow.com/questions/53596688/update-acf-fields-inside-layout-via-wp-api

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!