Support

Account

Home Forums Backend Issues (wp-admin) update_field Method does not update Field on User Edit Page Reply To: update_field Method does not update Field on User Edit Page

  • Looks like I’ve got this solved.

    – I added a priority (100) to my action
    – It seems like there is some caching active? I deleted the value in the database manually and then it wouldn’t update the value in the database.
    I guess ACF is comparing the target value with a cached existing value and if it’s equal, the db won’t be updated? Can you please confirm this and add a hint in the documentation?

    I tested it, storing a current timestamp in the custom field and now it gets updated properly

    update_field("field_5bd57f0208199","".time(),"user_".$current_user->ID);

    EDIT:
    This is not solved, the value does not get updated in the database:

    Code:
    `$prevalue= get_field(‘field_5bd57f0208199’,”user_”.$current_user->ID);
    error_log(“Pre Value is: “.$prevalue);
    update_field(“field_5bd57f0208199″,””.time(),”user_”.$current_user->ID);
    $postvalue= get_field(‘field_5bd57f0208199’,”user_”.$current_user->ID);
    error_log(“user profile updated. Value is: “.$postvalue);`

    This is the output if you execute the Profile update 2 times:

    	
    [28-Oct-2018 12:50:02 UTC] Pre Value is: 1540730664
    [28-Oct-2018 12:50:02 UTC] user profile updated. Value is: 1540731002
    [28-Oct-2018 12:50:36 UTC] Pre Value is: 1540731002
    [28-Oct-2018 12:50:36 UTC] user profile updated. Value is: 1540731036
    

    But I can’t find the values in the wp_usermeta-Table ?

    EDIT 2:
    I found an entry int the wp_options-Table:`

    option_id;option_name;option_value;autoload
    176;user__dev_text;1540731036;no
    177;_user__dev_text;field_5bd57f0208199;no

    Can you explain
    – Why is the value is not stored in the wp_usermeta-Table ?
    – Where is the reference between this entry and the current user?