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.
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’re reaching out to our multilingual users to ask for help in translating ACF 6.1. Help make sure the latest features are available in your language here: https://t.co/TkEc2Exd6U— Advanced Custom Fields (@wp_acf) May 22, 2023
© 2023 Advanced Custom Fields.