Set tax_query conditionally with new WP_Query
You can’t set query parameters after the query happens, set them before you make the query- $args = array( ‘post_type’ => ‘articles’, ‘paged’ => $paged, ); if( some condition ) $args[‘tax_query’] = array( your tax params ); $query = new WP_Query( $args );