AdvancedCustomFields / AdvancedCustomFields/acf
Rest API update fields not working as expected
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 945
- Forks
- 197
- PR merge metrics
- No merged PRs in 30d
Description
Hey there,
I'm having an issue when trying to update ACF fields using Rest API.
Following the documentation https://www.advancedcustomfields.com/resources/wp-rest-api-integration/ .
We should be able to update each field/property separately, but when i try to make a POST request.
It throws me an error, says that a property is required. It's like the request is trying to replace the whole ACF structure
instead of just trying to update one field
I'm using POSTMAN to test this out
Request:
curl --location --request POST 'https://example-site.com/wp-json/wp/v2/product/3295?acf_format=standard' \
--header 'Content-type: application/json' \
--header 'Authorization: Basic HIDDEN' \
--header 'Cookie: PHPSESSID=HIDDEN' \
--data-raw '{
"acf": {
"section3_video_bunny": "123"
}
}'
Response:
{
"code": "rest_invalid_param",
"message": "Invalid parameter(s): acf",
"data": {
"status": 400,
"params": {
"acf": "star_rating_average is a required property of acf."
},
"details": {
"acf": {
"code": "rest_property_required",
"message": "star_rating_average is a required property of acf.",
"data": null
}
}
}
}
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the ACF WordPress REST API integration documentation and reproduce the POST request shown against the /wp-json/wp/v2/product/3295 endpoint. Trace how the acf parameter validates required properties; done means updating section3_video_bunny without requiring unrelated ACF properties, with the request and response behavior covered by an appropriate test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php, wordpress
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100