Home › Forums › Backend Issues (wp-admin) › Nested meta_query causing database to time out (or give HTTP error 502) › Reply To: Nested meta_query causing database to time out (or give HTTP error 502)
This isn’t an inefficiency or ACF. It’s more of a problem with WP, although, that’s not really the case either. The problems are that your query is creating many, many joins doing multiple searches on a database column than is not optimized for searching.
This is explained in many places like https://wordpress.stackexchange.com/questions/158898/meta-query-terribly-slow and https://tommcfarlin.com/wp_query-and-multiple-meta-keys/.
There might not be a way to actually correct this, what follows is only a possible work around that has not been tested.
$ids = array_unique(array_merge($array1, $array2, $array3));
post__inargument. You would only need to do your sorting by the date in this last query.
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.