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__in
argument. 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 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.