I have a WordPress query and filter with checkboxes by category:

```
if( isset( $_POST['vertragsart'] ) && isset ($_POST['zeitmodell'])  ) {
    $args['tax_query'][] = array(
        array(
            'taxonomy' => 'category',
            'field' => 'id',
            'terms' => $_POST['vertragsart']
        ),
        array(
            'taxonomy' => 'category',
            'field' => 'id',
            'terms' => $_POST['zeitmodell']
        ),
    );

} elseif( !isset( $_POST['vertragsart'] ) && isset ($_POST['zeitmodell'])  ) {
    $args['tax_query'][] = array(
        'taxonomy' => 'category',
        'field' => 'id',
        'terms' => $_POST['zeitmodell']
    );

} elseif( isset( $_POST['vertragsart'] ) && !isset ($_POST['zeitmodell'])  ) {
    $args['tax_query'][] = array(
        'taxonomy' => 'category',
        'field' => 'id',
        'terms' => $_POST['vertragsart']
    );
}

```

This works as it should. On pageload he shows me all results and the user is able to limit the result with the checkboxes.

Now I want to add a third category filter - any idea how to do this? I think it will be way more complex because it is more than if/else.

I tried this but when it comes to the 3rd filter it just shows everything:

```
if( isset( $_POST['vertragsart'] ) && !isset ($_POST['zeitmodell']) && isset ($_POST['fachbereich'])  ) {
    $args['tax_query'][] = array(
        'taxonomy' => 'category',
        'field' => 'id',
        'terms' => $_POST['vertragsart']
    );      
    $args['tax_query'][] = array(
        'taxonomy' => 'category',
        'field' => 'id',
        'terms' => $_POST['fachbereich']
    );      
} elseif( isset( $_POST['vertragsart'] ) && isset ($_POST['zeitmodell']) && !isset ($_POST['fachbereich'])  ) {
    $args['tax_query'][] = array(
        'taxonomy' => 'category',
        'field' => 'id',
        'terms' => $_POST['vertragsart']
    );
    $args['tax_query'][] = array(
        'taxonomy' => 'category',
        'field' => 'id',
        'terms' => $_POST['zeitmodell']
    );
} elseif( isset( $_POST['vertragsart'] ) && !isset ($_POST['zeitmodell']) && isset ($_POST['fachbereich'])  ) {
    $args['tax_query'][] = array(
        'taxonomy' => 'category',
        'field' => 'id',
        'terms' => $_POST['vertragsart']
    );
    $args['tax_query'][] = array(
        'taxonomy' => 'category',
        'field' => 'id',
        'terms' => $_POST['fachbereich']
    );

} elseif( !isset( $_POST['vertragsart'] ) && !isset ($_POST['zeitmodell']) && isset ($_POST['fachbereich'])  ) {
    $args['tax_query'][] = array(
        'taxonomy' => 'category',
        'field' => 'id',
        'terms' => $_POST['fachbereich']
    );
} elseif( isset( $_POST['vertragsart'] ) && !isset ($_POST['zeitmodell']) && !isset ($_POST['fachbereich'])  ) {
    $args['tax_query'][] = array(
        'taxonomy' => 'category',
        'field' => 'id',
        'terms' => $_POST['vertragsart']
    );  
} elseif( !isset( $_POST['vertragsart'] ) && isset ($_POST['zeitmodell']) && !isset ($_POST['fachbereich'])  ) {
    $args['tax_query'][] = array(
        'taxonomy' => 'category',
        'field' => 'id',
        'terms' => $_POST['zeitmodell']
    );

// this won't work
} elseif( isset( $_POST['vertragsart'] ) && isset ($_POST['zeitmodell']) && isset ($_POST['fachbereich'])  ) {
    $args['tax_query'][] = array(
        array(
            'taxonomy' => 'category',
            'field' => 'id',
            'terms' => $_POST['vertragsart']
        ),
        array(
            'taxonomy' => 'category',
            'field' => 'id',
            'terms' => $_POST['zeitmodell']
        ),
        array(
            'taxonomy' => 'category',
            'field' => 'id',
            'terms' => $_POST['fachbereich']
        ),
    );
}

```