Ticket #19744: 19744.patch
File 19744.patch, 1.2 KB (added by , 8 years ago) |
---|
-
wp-includes/rewrite.php
292 292 293 293 // Check to see if we are using rewrite rules 294 294 $rewrite = $wp_rewrite->wp_rewrite_rules(); 295 295 296 296 // Not using rewrite rules, and 'p=N' and 'page_id=N' methods failed, so we're out of options 297 297 if ( empty($rewrite) ) 298 298 return 0; … … 332 332 333 333 $request = $url; 334 334 335 $post_type_query_vars = array(); 336 foreach ( $GLOBALS['wp_post_types'] as $post_type => $t ) { 337 if ( !empty( $t->query_var ) ) { 338 $post_type_query_vars[$t->query_var] = $post_type; 339 } 340 } 341 335 342 // Look for matches. 336 343 $request_match = $request; 337 344 foreach ( (array)$rewrite as $match => $query) { … … 361 368 parse_str($query, $query_vars); 362 369 $query = array(); 363 370 foreach ( (array) $query_vars as $key => $value ) { 364 if ( in_array( $key, $wp->public_query_vars) )371 if ( in_array( $key, $wp->public_query_vars ) ) { 365 372 $query[$key] = $value; 373 if ( isset( $post_type_query_vars[$key] ) ) { 374 $query['post_type'] = $post_type_query_vars[$key]; 375 $query['name'] = $value; 376 } 377 } 366 378 } 367 379 368 380 // Do the query 369 381 $query = new WP_Query($query); 370 382 if ( !empty($query->posts) && $query->is_singular )