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 use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.