diff --git wp-includes/class-wp.php wp-includes/class-wp.php
index dc77688..a254609 100644
|
|
class WP { |
247 | 247 | |
248 | 248 | $this->public_query_vars = apply_filters('query_vars', $this->public_query_vars); |
249 | 249 | |
250 | | foreach ( $GLOBALS['wp_post_types'] as $post_type => $t ) |
| 250 | foreach ( get_post_types( array(), 'objects' ) as $post_type => $t ) |
251 | 251 | if ( $t->query_var ) |
252 | 252 | $post_type_query_vars[$t->query_var] = $post_type; |
253 | 253 | |
… |
… |
class WP { |
280 | 280 | } |
281 | 281 | |
282 | 282 | // Convert urldecoded spaces back into + |
283 | | foreach ( $GLOBALS['wp_taxonomies'] as $taxonomy => $t ) |
| 283 | foreach ( get_taxonomies( array() , 'objects' ) as $taxonomy => $t ) |
284 | 284 | if ( $t->query_var && isset( $this->query_vars[$t->query_var] ) ) |
285 | 285 | $this->query_vars[$t->query_var] = str_replace( ' ', '+', $this->query_vars[$t->query_var] ); |
286 | 286 | |
diff --git wp-includes/query.php wp-includes/query.php
index 04286aa..22ba6ab 100644
|
|
class WP_Query { |
1699 | 1699 | ); |
1700 | 1700 | } |
1701 | 1701 | |
1702 | | foreach ( $GLOBALS['wp_taxonomies'] as $taxonomy => $t ) { |
| 1702 | foreach ( get_taxonomies( array() , 'objects' ) as $taxonomy => $t ) { |
1703 | 1703 | if ( 'post_tag' == $taxonomy ) |
1704 | 1704 | continue; // Handled further down in the $q['tag'] block |
1705 | 1705 | |
diff --git wp-includes/rewrite.php wp-includes/rewrite.php
index e2dbc80..114471a 100644
|
|
function url_to_postid($url) { |
338 | 338 | $url = trim($url, '/'); |
339 | 339 | |
340 | 340 | $request = $url; |
| 341 | $post_type_query_vars = array(); |
| 342 | |
| 343 | foreach ( get_post_types( array() , 'objects' ) as $post_type => $t ) { |
| 344 | if ( ! empty( $t->query_var ) ) |
| 345 | $post_type_query_vars[ $t->query_var ] = $post_type; |
| 346 | } |
341 | 347 | |
342 | 348 | // Look for matches. |
343 | 349 | $request_match = $request; |
… |
… |
function url_to_postid($url) { |
365 | 371 | |
366 | 372 | // Filter out non-public query vars |
367 | 373 | global $wp; |
368 | | parse_str($query, $query_vars); |
| 374 | parse_str( $query, $query_vars ); |
369 | 375 | $query = array(); |
370 | 376 | foreach ( (array) $query_vars as $key => $value ) { |
371 | | if ( in_array($key, $wp->public_query_vars) ) |
| 377 | if ( in_array( $key, $wp->public_query_vars ) ){ |
372 | 378 | $query[$key] = $value; |
| 379 | if ( isset( $post_type_query_vars[$key] ) ) { |
| 380 | $query['post_type'] = $post_type_query_vars[$key]; |
| 381 | $query['name'] = $value; |
| 382 | } |
| 383 | } |
373 | 384 | } |
374 | 385 | |
375 | 386 | // Do the query |
376 | | $query = new WP_Query($query); |
377 | | if ( !empty($query->posts) && $query->is_singular ) |
| 387 | $query = new WP_Query( $query ); |
| 388 | if ( ! empty( $query->posts ) && $query->is_singular ) |
378 | 389 | return $query->post->ID; |
379 | 390 | else |
380 | 391 | return 0; |