Query by Taxonomy

Taxonomies are extremely useful for categorizing content within your WordPress site. Building a query to show those post is something that I had trouble finding. So I’m posting this so other will be able to use it.

function cc_community_partner_query() {
    $args = array(
        'post_type' => 'partner',
        'posts_per_page' => 99,
        'tax_query' => array(
            array(
                'taxonomy' => 'partner-levels',
                'field' => 'slug',
                'terms' => 'community-partners',
                'operator' => 'NOT IN'
            )
        )
    );
    $community_partners = new WP_Query( $args );
    return $community_partners;
}