Changeset 34215
- Timestamp:
- 09/15/2015 06:53:12 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp.php
r33734 r34215 262 262 $this->public_query_vars = apply_filters( 'query_vars', $this->public_query_vars ); 263 263 264 foreach ( get_post_types( array(), 'objects' ) as $post_type => $t ) 265 if ( $t->query_var )264 foreach ( get_post_types( array(), 'objects' ) as $post_type => $t ) { 265 if ( is_post_type_viewable( $t ) && $t->query_var ) { 266 266 $post_type_query_vars[$t->query_var] = $post_type; 267 } 268 } 267 269 268 270 foreach ( $this->public_query_vars as $wpvar ) { -
trunk/src/wp-includes/post-functions.php
r34201 r34215 1073 1073 } 1074 1074 1075 if ( false !== $args->query_var && ! empty( $wp )) {1075 if ( false !== $args->query_var ) { 1076 1076 if ( true === $args->query_var ) 1077 1077 $args->query_var = $post_type; 1078 1078 else 1079 1079 $args->query_var = sanitize_title_with_dashes( $args->query_var ); 1080 $wp->add_query_var( $args->query_var ); 1080 1081 if ( $wp && is_post_type_viewable( $args ) ) { 1082 $wp->add_query_var( $args->query_var ); 1083 } 1081 1084 } 1082 1085 -
trunk/tests/phpunit/includes/utils.php
r33123 r34215 363 363 364 364 foreach ( get_post_types( array() , 'objects' ) as $t ) { 365 if ( ! empty( $t->query_var ) )365 if ( is_post_type_viewable( $t ) && ! empty( $t->query_var ) ) 366 366 $GLOBALS['wp']->add_query_var( $t->query_var ); 367 367 } -
trunk/tests/phpunit/tests/rewrite.php
r32918 r34215 145 145 } 146 146 147 /** 148 * @ticket 30018 149 */ 150 function test_parse_request_home_path_non_public_type() { 151 register_post_type( 'foo', array( 'public' => false ) ); 152 153 $url = add_query_arg( 'foo', '1', home_url() ); 154 155 $this->go_to( $url ); 156 157 _unregister_post_type( 'foo' ); 158 159 $this->assertEquals( array(), $GLOBALS['wp']->query_vars ); 160 } 161 147 162 function test_url_to_postid_dupe_path() { 148 163 update_option( 'home', home_url('/example/') );
Note: See TracChangeset
for help on using the changeset viewer.