mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 20:30:23 +00:00
Make url_to_postid() work for custom post type URLs. Use get_post_types() and get_taxonomies() instead of directly accessing globals. Adds unit test.
Props faishal, for the globals fix. Fixes #19744. git-svn-id: https://develop.svn.wordpress.org/trunk@25659 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -238,7 +238,7 @@ class WP {
|
||||
|
||||
$this->public_query_vars = apply_filters('query_vars', $this->public_query_vars);
|
||||
|
||||
foreach ( $GLOBALS['wp_post_types'] as $post_type => $t )
|
||||
foreach ( get_post_types( array(), 'objects' ) as $post_type => $t )
|
||||
if ( $t->query_var )
|
||||
$post_type_query_vars[$t->query_var] = $post_type;
|
||||
|
||||
@@ -271,7 +271,7 @@ class WP {
|
||||
}
|
||||
|
||||
// Convert urldecoded spaces back into +
|
||||
foreach ( $GLOBALS['wp_taxonomies'] as $taxonomy => $t )
|
||||
foreach ( get_taxonomies( array() , 'objects' ) as $taxonomy => $t )
|
||||
if ( $t->query_var && isset( $this->query_vars[$t->query_var] ) )
|
||||
$this->query_vars[$t->query_var] = str_replace( ' ', '+', $this->query_vars[$t->query_var] );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user