Home Forums Backend Issues (wp-admin) update_field() not working with get_field()


update_field() not working with get_field()

  • 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: field_name

Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘update_field() not working with get_field()’ is closed to new replies.