diff --git a/src/wp-includes/class-wp-taxonomy.php b/src/wp-includes/class-wp-taxonomy.php index 147d22489363f..7063bea95c18c 100644 --- a/src/wp-includes/class-wp-taxonomy.php +++ b/src/wp-includes/class-wp-taxonomy.php @@ -510,15 +510,12 @@ public function add_rewrite_rules() { $tag = '([^/]+)'; } - if ( $this->query_var ) { - add_rewrite_tag( "%taxonomy-$this->name%", "$this->name()", "{$this->query_var}=" ); - } else { - add_rewrite_tag( "%taxonomy-$this->name%", "($this->name)", 'taxonomy=' ); - } + $query = $this->query_var ? "{$this->query_var}=" : "taxonomy=$this->name&term="; + add_rewrite_tag( "%taxonomy-$this->name%", "$this->name()", $query ); add_permastruct( "taxonomy-$this->name", "%taxonomy-$this->name%", $this->rewrite ); - add_rewrite_tag( "%$this->name%", $tag, $this->query_var ? "{$this->query_var}=" : "taxonomy=$this->name&term=" ); + add_rewrite_tag( "%$this->name%", $tag, $query ); add_permastruct( $this->name, "{$this->rewrite['slug']}/%$this->name%", $this->rewrite ); } }