diff --git src/wp-includes/taxonomy.php src/wp-includes/taxonomy.php
index 84cc91a..dba6e54 100644
|
|
|
function register_taxonomy( $taxonomy, $object_type, $args = array() ) { |
| 390 | 390 | else |
| 391 | 391 | $args['query_var'] = sanitize_title_with_dashes( $args['query_var'] ); |
| 392 | 392 | $wp->add_query_var( $args['query_var'] ); |
| | 393 | } else { |
| | 394 | // Force query_var to false for non-public taxonomies. |
| | 395 | $args['query_var'] = false; |
| 393 | 396 | } |
| 394 | 397 | |
| 395 | 398 | if ( false !== $args['rewrite'] && ( is_admin() || '' != get_option( 'permalink_structure' ) ) ) { |
diff --git tests/phpunit/tests/taxonomy.php tests/phpunit/tests/taxonomy.php
index 2063bbe..0cf6516 100644
|
|
|
class Tests_Taxonomy extends WP_UnitTestCase { |
| 517 | 517 | |
| 518 | 518 | $this->assertFalse( is_tax( 'wptests_tax' ) ); |
| 519 | 519 | } |
| | 520 | |
| | 521 | /** |
| | 522 | * @ticket 35089 |
| | 523 | */ |
| | 524 | public function test_query_var_should_be_forced_to_false_for_non_public_taxonomy() { |
| | 525 | register_taxonomy( 'wptests_tax', 'post', array( |
| | 526 | 'public' => false, |
| | 527 | 'query_var' => true, |
| | 528 | ) ); |
| | 529 | |
| | 530 | $tax = get_taxonomy( 'wptests_tax' ); |
| | 531 | $this->assertFalse( $tax->query_var ); |
| | 532 | } |
| 520 | 533 | } |