Home › Forums › General Issues › Query ACF too slow
Hello i have problem query ACF too slow.
Scenario :
I have custom posttype :
1. Club (id, CLUB NAME)
2. Match (home_club, goal_home, competition, away_club, goal_away)
3. competition (Id, competition name)
I try show head to head CLUB A VS Club B, so i will show all match ( Club A as home and Club B as away ) AND (Club A as away and club B as home). I use this query argument, but time to load 6s.
$type = 'match';
$args = array(
'post_type' => $type,
'posts_per_page' => '5',
'post_status' => 'publish',
'meta_query' => array(
array(
'relation' => 'AND',
array(
'key' => 'home_club',
'value' => $home[1],
'compare' => '='
),
array(
'key' => 'club_away',
'value' => $away[1],
'compare' => '='
), array(
'key' => 'is_finish',
'value' => true,
'compare' => '='
)
),
'relation' => 'OR',
array(
'relation' => 'AND',
array(
'key' => 'home_club',
'value' => $away[1],
'compare' => '='
),
array(
'key' => 'club_away',
'value' => $home[1],
'compare' => '='
), array(
'key' => 'is_finish',
'value' => true,
'compare' => '='
)
),
),
'orderby' => 'meta_value_num',
'meta_key' => 'tanggal_main',
'order' => 'desc',
);
Can you suggest me for better query.
The problem is not with ACF, the problem is that multiple joins to the postmeta table slow WP down, and the fix that WP put in for this does not really fix the problem. Here is the current ticket for this I believe https://core.trac.wordpress.org/ticket/30044
If you do a search for “multiple meta queries slow down wp” you might find some possible solutions.
The topic ‘Query ACF too slow’ is closed to new replies.
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.