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!
The ACF site is currently experiencing some issues.— Advanced Custom Fields (@wp_acf) September 29, 2022
We apologize for the inconvenience and we are working hard to get it back up and running as soon as possible.
© 2022 Advanced Custom Fields.