• I have a some categories set up like so:

    Age
    Child
    Teen
    Adult
    Language
    English
    Spanish
    French
    Where Age and Language are parent categories, and those following are child categories.

    Relevant code below:

    $cat = (isset($_GET['cat'])) ? $_GET['cat'] : 0;
    $args = array(
                'tax_query' => array(
                    array(
                        'taxonomy' => 'tribe_events_cat',
                        'field' => 'id',
                        'terms' => $cat,
                    ),
    
                )
        );
        $my_query = new WP_Query($args);

    Right if I choose Child and Teen it will display all posts tagged with Child OR Teen, which is desired. But if I also choose Spanish, it will display events tagged with Child OR Teen OR Spanish.

    How can I fix my query so that if I choose Child and Spanish, it will pull posts tagged with Child AND Spanish instead of posts tagged with Child OR Spanish?

The topic ‘[Plugin: Events Calendar] Filtering by Parent Categories’ is closed to new replies.