最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Fill up advanced custom field of a custom post type via API REST POST

programmeradmin0浏览0评论

I have few custom fields created by ACF on a custom post type "room".

I use postman and the REST API to try to create a new room with my custom fields.

The Autorization is ok. I success to create my room, but all the custom fields are empty. I'm sending a raw content like this :

{
"title":"Sample ACF field demo",
"status": "publish",
"acf": 
    {      
        "title_fields" : "Custom title",  
        "rent_field" : 100,
    }
}

Why, the custom fields stay empty ? I'm doing something wrong ?

Thanks

I have few custom fields created by ACF on a custom post type "room".

I use postman and the REST API to try to create a new room with my custom fields.

The Autorization is ok. I success to create my room, but all the custom fields are empty. I'm sending a raw content like this :

{
"title":"Sample ACF field demo",
"status": "publish",
"acf": 
    {      
        "title_fields" : "Custom title",  
        "rent_field" : 100,
    }
}

Why, the custom fields stay empty ? I'm doing something wrong ?

Thanks

Share Improve this question edited Feb 1, 2021 at 19:13 djoo asked Feb 1, 2021 at 19:02 djoodjoo 1577 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

Found it :

Replace acf by fields

{
"title":"Sample ACF field demo",
"status": "publish",
"fields": 
    {      
        "title_fields" : "Custom title",  
        "rent_field" : 100,
    }
}
发布评论

评论列表(0)

  1. 暂无评论