Support

Account

Home Forums ACF PRO Meta query doesn't work after update_field until manual update in admin Reply To: Meta query doesn't work after update_field until manual update in admin

  • I don’t know if this is the cause of your problem or not

    
    $account = get_field('transaction_account', $post_id);
    

    returns a post object and not just the ID unless you have the field setting to return just the ID.

    This may or may not return an array of post IDs it it allows multiple values.

    To get just the post ID at this point you can also do

    
    $account = get_field('transaction_account', $post_id, false);
    

    This following expects the value to be a post ID or an array of post IDs depending on if the post object can hold multiple selections or not.

    
    update_field( 'field_5f1ddb03428bf', $account, $balance_post_id );
    

    A am assuming that this is saving the full post object into the field when load the field in the admin it is seeing that it is a full post object and correcting the saved value when you save.