Ticket #30018: 30018.3.diff
File 30018.3.diff, 2.7 KB (added by , 5 years ago) |
---|
-
src/wp-includes/class-wp.php
261 261 */ 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 ) { 269 271 if ( isset( $this->extra_query_vars[$wpvar] ) ) -
src/wp-includes/post-functions.php
1072 1072 add_post_type_support( $post_type, array( 'title', 'editor' ) ); 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 1083 1086 if ( false !== $args->rewrite && ( is_admin() || '' != get_option( 'permalink_structure' ) ) ) { -
tests/phpunit/includes/utils.php
362 362 } 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 } 368 368 } -
tests/phpunit/tests/rewrite.php
144 144 $this->assertEquals( array( 'page' => '', 'pagename' => 'match/page' ), $GLOBALS['wp']->query_vars ); 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/') ); 149 164