diff --git wp-includes/query.php wp-includes/query.php
index 04286aa..1ff5be3 100644
--- wp-includes/query.php
+++ wp-includes/query.php
@@ -2080,17 +2080,26 @@ class WP_Query {
 			$where .= " AND DAYOFMONTH($wpdb->posts.post_date)='" . $q['day'] . "'";
 
 		// If we've got a post_type AND it's not "any" post_type.
-		if ( !empty($q['post_type']) && 'any' != $q['post_type'] ) {
-			foreach ( (array)$q['post_type'] as $_post_type ) {
-				$ptype_obj = get_post_type_object($_post_type);
-				if ( !$ptype_obj || !$ptype_obj->query_var || empty($q[ $ptype_obj->query_var ]) )
+		if ( ! empty( $q['post_type'] ) && 'any' !== $q['post_type'] ) {
+			foreach ( (array) $q['post_type'] as $_post_type ) {
+				$ptype_obj = get_post_type_object( $_post_type );
+				if ( ! $ptype_obj )
 					continue;
 
-				if ( ! $ptype_obj->hierarchical || strpos($q[ $ptype_obj->query_var ], '/') === false ) {
+				// Map 'name' to 'pagename' for hierarchical post types without a custom query_var
+				if ( ! $ptype_obj->query_var && $ptype_obj->hierarchical && false !== strpos( $q['name'], '/' ) ) {
+					$q['pagename'] = $q['name'];
+					$q['name'] = '';
+				}
+
+				if ( ! $ptype_obj->query_var || empty($q[ $ptype_obj->query_var ]) )
+					continue;
+
+				if ( ! $ptype_obj->hierarchical || false === strpos( $q[ $ptype_obj->query_var ], '/' ) ) {
 					// Non-hierarchical post_types & parent-level-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 the 'pagename' query var
 					$q['pagename'] = $q[ $ptype_obj->query_var ];
 					$q['name'] = '';
 				}
@@ -2098,7 +2107,7 @@ class WP_Query {
 				// Only one request for a slug is possible, this is why name & pagename are overwritten above.
 				break;
 			} //end foreach
-			unset($ptype_obj);
+			unset( $ptype_obj );
 		}
 
 		if ( '' != $q['name'] ) {
