I am trying to publish a post in WP using rest api. I need some extra field too. So I have installed ACF plugin to insert extra field. After sending the request it returning 201 (post is created) but extra field value remaining empty(not updating).
data = {
"title": (data['title']),
"content": (data['full_content']),
"author": 1,
"status": "draft",
"featured_media": get_image_id,
"acf" : {
"intro": "another try"
}
}
response = requests.post(url, headers=headers, json=post_data)
Here intro
is my custom field. In ACF plugin REST API option is True and in get request acf
values showing empty value.So how can I insert extra field value?
In your request above, try to use "fields"
, instead of "acf"
. See more in this comment.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With