mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-07-01 07:40:07 +00:00
Prevent multiple hierarchical posts with the same slug from being displayed in single post template.
fixes #28611. git-svn-id: https://develop.svn.wordpress.org/trunk@28803 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -2372,11 +2372,11 @@ class WP_Query {
|
||||
if ( !$ptype_obj || !$ptype_obj->query_var || empty($q[ $ptype_obj->query_var ]) )
|
||||
continue;
|
||||
|
||||
if ( ! $ptype_obj->hierarchical || strpos($q[ $ptype_obj->query_var ], '/') === false ) {
|
||||
// Non-hierarchical post_types & parent-level-hierarchical post_types can directly use 'name'
|
||||
if ( ! $ptype_obj->hierarchical ) {
|
||||
// Non-hierarchical post types can directly use 'name'.
|
||||
$q['name'] = $q[ $ptype_obj->query_var ];
|
||||
} else {
|
||||
// Hierarchical post_types will operate through the
|
||||
// Hierarchical post types will operate through 'pagename'.
|
||||
$q['pagename'] = $q[ $ptype_obj->query_var ];
|
||||
$q['name'] = '';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user