From a0940de83dbdb53a5da7d34a4fe99d6427404745 Mon Sep 17 00:00:00 2001 From: Jon Cave Date: Fri, 30 Aug 2013 08:07:06 +0000 Subject: [PATCH] Correct rewrite tag for hierarchical post types without a query_var. Hierarchical rewrite rules operate via the 'pagename' query variable which is passed to get_page_by_path(). However, the current rewrite rules use the 'name' query variable for hierarchical types without a custom query_var. Fixes #16323. git-svn-id: https://develop.svn.wordpress.org/trunk@25182 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/post.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wp-includes/post.php b/src/wp-includes/post.php index 0312f6457e..c2b60a83e9 100644 --- a/src/wp-includes/post.php +++ b/src/wp-includes/post.php @@ -1292,7 +1292,7 @@ function register_post_type( $post_type, $args = array() ) { } if ( $args->hierarchical ) - add_rewrite_tag( "%$post_type%", '(.+?)', $args->query_var ? "{$args->query_var}=" : "post_type=$post_type&name=" ); + add_rewrite_tag( "%$post_type%", '(.+?)', $args->query_var ? "{$args->query_var}=" : "post_type=$post_type&pagename=" ); else add_rewrite_tag( "%$post_type%", '([^/]+)', $args->query_var ? "{$args->query_var}=" : "post_type=$post_type&name=" );