• Hello,

    I have custom post type with field like this:
    home_club, away_club, is_finish.

    And I have problem when create head to head player, my filter too slow filter this:
    Select all mypost type where (home_club == "A" AND away_club == "B" AND is_finish == TRUE ) OR (home_club = "B" and away_club = "A" and is_finish = "TRUE")

    And my Code this:

    <?php
                                      $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',
                                      );

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Multiple Filter Too Slow’ is closed to new replies.