WordPress.org

Make WordPress Core

Ticket #16438: 16438.diff

File 16438.diff, 743 bytes (added by jltallon, 4 years ago)

Remove post_type='attachment' from get_page_path

  • wp-includes/post.php

    a b  
    31333133       foreach ( (array) $page_paths as $pathdir ) 
    31343134               $full_path .= ( $pathdir != '' ? '/' : '' ) . sanitize_title($pathdir); 
    31353135 
    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 FROM $wpdb->posts WHERE post_name = %s AND post_type = %s", $leaf_path, $post_type )); 
    31373137 
    31383138       if ( empty($pages) ) 
    31393139               return $null;