update_field('sector', $json_string->category->sector, $org_id_prefixed); update_field('industry_group', $json_string->category->industryGroup, $org_id_prefixed); update_field('industry', $json_string->category->industryGroup, $org_id_prefixed); update_field('subindustry', $json_string->category->industryGroup, $org_id_prefixed);
Where, FYI, the incoming values are…
[category] => stdClass Object ( [sector] => Information Technology [industryGroup] => Technology Hardware & Equipment [industry] => Technology Hardware, Storage & Peripherals [subIndustry] => Computer Hardware [sicCode] => 73 [naicsCode] => 51 )
When I enter a new Checkbox value in the GUI, manually, it is properly saved as a Choice.
But, when I use update_field, it does not happen. This means the values 1. persist as editable text boxes, not just check boxes and 2. don’t actually even show in columns my wp-admin edit list…
The weird thing, however, is that, when I enter an arbitrary new value in the GUI, not only does the specific value get saved as a Choice and becomes visible in a column, it also shakes all values previously saved with update_field in to acting properly…
So, when I add a new value “Test Value” to the “sector” Checkbox, it fixes all “sector” values as Choices – and also those of “industry_group”, “industry” and “subindustry”.
This is a happy side effect, but it doesn’t feel like this should be the correct behaviour, and it won’t change the fact that using programmatic update_field alone doesn’t fix values as Choices.
(Don’t want to hijack the thread, but my attempt to create a new one was diverted to support).
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!