So I’m running a function that runs the update_field() hook to update a field on the user’s profile page. I find that when I run this function and hook then check the profile page inside wordpress, the change is made! (YAY)
Nevertheless when I attempt to call that same field with get_field, it returns nothing.
To fix this, I have to go into the wordpress profile editing page, and then manually save without making any changes to the data.
This allows the get_field function to work normally.
I’m not sure what exactly I’ve done wrong in this case – do I need to use a different function to get_field after using update_field?
Hi @benjaminpott
I think that this issue could be caused by a referencing issue.
In the update_field(...)
function, could you please use the $field_key
to reference the field instead of the $field_name
. For more info, have a look at: http://www.advancedcustomfields.com/resources/update_field/#field_key-vs field_name