diff --git wp-includes/post.php wp-includes/post.php
index c4422bc..f0040a9 100644
|
|
function get_page_by_path($page_path, $output = OBJECT, $post_type = 'page') { |
3133 | 3133 | foreach ( (array) $page_paths as $pathdir ) |
3134 | 3134 | $full_path .= ( $pathdir != '' ? '/' : '' ) . sanitize_title($pathdir); |
3135 | 3135 | |
3136 | | $pages = $wpdb->get_results( $wpdb->prepare( "SELECT ID, post_name, post_parent FROM $wpdb->posts WHERE post_name = %s AND (post_type = %s OR post_type = 'attachment')", $leaf_path, $post_type )); |
| 3136 | $pages = $wpdb->get_results( $wpdb->prepare( "SELECT ID, post_name, post_parent, post_type FROM $wpdb->posts WHERE post_name = %s AND (post_type = %s OR post_type = 'attachment')", $leaf_path, $post_type )); |
3137 | 3137 | |
3138 | 3138 | if ( empty($pages) ) |
3139 | 3139 | return $null; |
3140 | 3140 | |
3141 | 3141 | foreach ( $pages as $page ) { |
3142 | | $path = '/' . $leaf_path; |
| 3142 | $path = '/' . ( $page->post_type == 'attachment' ? 'attachment/' : '' ) . $leaf_path; |
3143 | 3143 | $curpage = $page; |
3144 | 3144 | while ( $curpage->post_parent != 0 ) { |
3145 | 3145 | $post_parent = $curpage->post_parent; |