How to do a particular wp_query taxonomy search

Seems like the easiest thing to do is to apply the tax query only if at least one “experience” term has been specified. Something like:

// Get passed vars
$experience = $_GET['experience'];

// Start building the args array
$args = array(   
    'post_type' => 'page',      
);

// If any experience items were passed
if( is_array( $experience ) && count( $experience ) > 0 ) {

    // Get an array of possible "experience" terms as a whitelist to check against.
    $arr_term_details = get_terms( 'experience1', array( 'hide_empty' => 0 ) );
    $arr_terms = array();
    foreach($arr_term_details as $this_term) {
        array_push($arr_terms, $this_term->slug);
    }

    // If ALL of the experience terms exist in the whitelist
    if( count(array_intersect( $experience, $arr_terms )) == count($experience) ) {

        // Add the tax query
        $args['tax_query'] = array(
            array(
                'taxonomy' => 'experience1',
                'field' => 'slug',
                'terms' => $experience
            )
        );

    }

}

// Run the query
$query = new WP_Query( $args );

The if condition may be wrong–I forget how forms pass values for multi-selects.

UPDATE: added a whitelist-style check for the $_GET data, per Chip Bennett’s suggestion.

error code: 523