@@ -81,30 +81,10 @@ public function validate_term( \WP_Term $term ) {
8181 return null ;
8282 }
8383
84- // Check if an array has a key that starts with a string.
85- $ is_same_term = false ;
86-
87- $ taxonomy = $ term ->taxonomy ;
88-
89- // Categories and Tags can use a shorthand in the query vars.
90- if ( 'category ' === $ taxonomy ) {
91- $ taxonomy = 'cat ' ;
92- } elseif ( 'post_tag ' === $ taxonomy ) {
93- $ taxonomy = 'tag ' ;
94- }
95-
96- foreach ( array_keys ( $ this ->wp ->query_vars ) as $ key ) {
97- if ( strpos ( $ key , $ taxonomy ) === 0 ) {
98- $ is_same_term = true ;
99- break ;
100- }
101- }
102-
103- if ( ! $ is_same_term ) {
84+ if ( isset ( $ this ->wp ->query_vars ['taxonomy ' ] ) && $ term ->taxonomy !== $ this ->wp ->query_vars ['taxonomy ' ] ) {
10485 return null ;
10586 }
10687
107-
10888 return $ term ;
10989 }
11090
@@ -359,11 +339,9 @@ public function parse_request( string $uri, $extra_query_vars = '' ) {
359339 */
360340 global $ wp_rewrite ;
361341
362-
363342 $ this ->wp ->query_vars = [];
364343 $ post_type_query_vars = [];
365344
366-
367345 if ( is_array ( $ extra_query_vars ) ) {
368346 $ this ->wp ->query_vars = &$ extra_query_vars ;
369347 } elseif ( ! empty ( $ extra_query_vars ) ) {
@@ -501,7 +479,6 @@ public function parse_request( string $uri, $extra_query_vars = '' ) {
501479 */
502480 $ this ->wp ->public_query_vars = apply_filters ( 'query_vars ' , $ this ->wp ->public_query_vars );
503481
504-
505482 foreach ( get_post_types ( [ 'show_in_graphql ' => true ], 'objects ' ) as $ post_type => $ t ) {
506483 /** @var \WP_Post_Type $t */
507484 if ( $ t ->query_var ) {
0 commit comments