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
Thanks for your response @hube2 ! I’ll try to fill in:
The fields are set like this:
$updated_balance = get_field('updated_balance', $post_id);
$transaction_date = get_field('transaction_date', $post_id);
$account = get_field('transaction_account', $post_id);
Where updated_balance is a number field, where transaction_date is a date field and transaction_account is a post object field selecting a ik_account CPT.
All these fields are set on a new ik_balance CPT post when a ik_transaction CPT post is saved.
So, in the query, I’m first looping through all posts of the ik_account CPT, getting only the post ID which is what’s populating $account_id. Inside that loop, the above query fetches the last ik_balance CPT where the balance_account post object field equals $account_id.
Hope this makes things at least somewhat more clear. Otherwise I’ll try to clarify further!
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.