Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Edit Custom Field Group select options via Rest API #405

Open
prononext opened this issue Oct 6, 2022 · 0 comments
Open

Edit Custom Field Group select options via Rest API #405

prononext opened this issue Oct 6, 2022 · 0 comments

Comments

@prononext
Copy link

prononext commented Oct 6, 2022

Dear airesvg,

I want to edit the select options inside a ACF field group via Rest API.

My ACF fields are linked to the product post-type.

I tried the following via Postman:

POST: https://example.com/wp-json/acf/v3/product/IDOFTHEFIELDGROUP

also tried:
POST: https://example.com/wp-json/acf/v3/product/IDOFTHEFIELDGROUP/NAMEOFTHEFIELD

with body and/or query:
{ "key": "field_633ee9a8333fc", "label": "testselect", "name": "testselect", "type": "select", "choices": [ "red", "blue" ], "default_value": "", "allow_null": "1", "multiple": "0" }

or:
{ "choices": [ "red", "blue" ] }

Sadly none of them worked.

Also if I do a:

GET: https://example.com/wp-json/acf/v3/product/IDOFTHEFIELDGROUP/testselect

I get:

`[
{
"testselect": null
}
]`

Something seems to be wrong as all other standard wordpress Rest API Calls are working ok. Also filling the custom fields inside a existing post / product or any other doctype is no problem.

I also edited the functions.php with the options you gave in the readme, and activated them accordingly:

`/ Enable the option show in rest
add_filter( 'acf/rest_api/field_settings/show_in_rest', '__return_true' );

// Enable the option edit in rest
add_filter( 'acf/rest_api/field_settings/edit_in_rest', '__return_true' );`

No success.

Please help. I am also willing to support this project further if its functionality is working for me.

Thank you
Have a nice day

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant