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);
updated_balance is a number field, where
transaction_date is a date field and
transaction_account is a post object field selecting a
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
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!
Plugin boilerplates can do some of the heavy lifting during initial development. We look at four options to speed up your plugin creation. https://t.co/ZtMsdBxAHw— Advanced Custom Fields (@wp_acf) June 5, 2023
© 2023 Advanced Custom Fields.