Home › Forums › General Issues › update_field not updating fiel › Reply To: update_field not updating fiel
This is getting weirder and weirder and beginning to think there is a bug somewhere.
Here are two field I have:
Key: field_64c782fc4c55d
Name: qgis_aa_zoom
Group: fs_ski_resort_data
Key: field_64a54023795f5
Name: fs_aa_zoom
Group: fs_ski_resort_data
I have tried the most basic code as follows to update;
update_field('field_64c782fc4c55d', 12, 1074);
If I go to my custom posts and look at the field, it is empty, however, if I do this;
echo 'field_64c782fc4c55d: '.get_field(field_64c782fc4c55d, 1074);
I get 12, as updated above. Bizzare.
I have an API that calls the field by name, rather than key as follows;
`$fs_ski_resorts_data[$i][‘fs_ski_resort_aa_zoom’] =
get_field(‘fs_ski_resort_data_fs_aa_zoom’) ?:
get_field(‘fs_ski_resort_data_qgis_aa_zoom’); `
Above produces: "fs_ski_resort_aa_zoom": "", // empty string
If I manually insert data via the view of my custom post type, say, 7, I get this;
"fs_ski_resort_aa_zoom": "7",
So there seems to be something going on in the database and things are not matching correctly.
Any help appreciated.
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!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.