Index: src/wp-includes/query.php
===================================================================
--- src/wp-includes/query.php	(revision 25309)
+++ src/wp-includes/query.php	(working copy)
@@ -3057,20 +3057,25 @@
 		$this->queried_object_id = 0;
 
 		if ( $this->is_category || $this->is_tag || $this->is_tax ) {
-			$tax_query_in_and = wp_list_filter( $this->tax_query->queries, array( 'operator' => 'NOT IN' ), 'NOT' );
+			if ( $this->is_tag ) {
+				$term = get_term( $this->get( 'tag_id' ), 'post_tag' );
+			} else if ( $this->is_category ) {
+				$term = get_term( $this->get( 'cat' ), 'category' );
+			} else {
+				$tax_query_in_and = wp_list_filter( $this->tax_query->queries, array( 'operator' => 'NOT IN' ), 'NOT' );
+				$query = reset( $tax_query_in_and );
 
-			$query = reset( $tax_query_in_and );
+				if ( 'term_id' == $query['field'] )
+					$term = get_term( reset( $query['terms'] ), $query['taxonomy'] );
+				else
+					$term = get_term_by( $query['field'], reset( $query['terms'] ), $query['taxonomy'] );
+			}
 
-			if ( 'term_id' == $query['field'] )
-				$term = get_term( reset( $query['terms'] ), $query['taxonomy'] );
-			elseif ( $query['terms'] )
-				$term = get_term_by( $query['field'], reset( $query['terms'] ), $query['taxonomy'] );
-
 			if ( ! empty( $term ) && ! is_wp_error( $term ) )  {
 				$this->queried_object = $term;
 				$this->queried_object_id = (int) $term->term_id;
 
-				if ( $this->is_category )
+				if ( $this->is_category && 'category' === $this->queried_object->taxonomy )
 					_make_cat_compat( $this->queried_object );
 			}
 		} elseif ( $this->is_post_type_archive ) {
Index: tests/phpunit/tests/query/conditionals.php
===================================================================
--- tests/phpunit/tests/query/conditionals.php	(revision 25309)
+++ tests/phpunit/tests/query/conditionals.php	(working copy)
@@ -716,4 +716,41 @@
 	function pre_get_posts_with_type_array( &$query ) {
 		$query->set( 'post_type', array( 'post', 'thearray' ) );
 	}
+
+	function test_tax_category_tax_query() {
+		register_taxonomy( 'testtax', array( 'public' => true ) );
+
+		$tag_id = $this->factory->tag->create( array( 'slug' => 'tag-slug' ) );
+		$cat_id = $this->factory->category->create( array( 'slug' => 'cat-slug' ) );
+		$tax_id = $this->factory->term->create( array( 'taxonomy' => 'testtax', 'slug' => 'tax-slug' ) );
+		$post_id = $this->factory->post->create();
+		wp_set_object_terms( $post_id, $tag_id, 'post_tag' );
+		wp_set_object_terms( $post_id, $cat_id, 'category' );
+		wp_set_object_terms( $post_id, $tax_id, 'testtax' );
+
+		add_action( 'pre_get_posts', array( $this, 'pre_get_posts_tax_category_tax_query' ) );
+
+		$this->go_to( "/tag/tag-slug/" );
+		$this->assertQueryTrue( 'is_tag', 'is_archive' );
+		$this->assertEquals( get_queried_object(), get_term( $tag_id, 'post_tag' ) );
+
+		$this->go_to( "/category/cat-slug/" );
+		$this->assertQueryTrue( 'is_category', 'is_archive' );
+		$cat = get_term( $cat_id, 'category' );
+		_make_cat_compat( $cat );
+		$this->assertEquals( get_queried_object(), $cat );
+
+		$this->go_to( "/tag/tag-slug/?cat=$cat_id" );
+		$this->assertQueryTrue( 'is_tag', 'is_category', 'is_archive' );
+		$this->assertEquals( get_queried_object(), get_term( $tag_id, 'post_tag' ) );
+
+		remove_action( 'pre_get_posts', array( $this, 'pre_get_posts_tax_category_tax_query' ) );
+	}
+
+	function pre_get_posts_tax_category_tax_query( &$query ) {
+		$term = get_term_by( 'slug', 'tax-slug', 'testtax' );
+		$query->set( 'tax_query', array(
+			array( 'taxonomy' => 'testtax', 'field' => 'term_id', 'terms' => $term->term_id )
+		) );
+	}
 }
