WordPress.org

Make WordPress Core

Ticket #11373: 11373.2.diff

File 11373.2.diff, 820 bytes (added by wojtek.szkutnik, 8 years ago)
  • wp-includes/post.php

     
    29082908                $path = '/' . $leaf_path;
    29092909                $curpage = $page;
    29102910                while ( $curpage->post_parent != 0 ) {
    2911                         $curpage = $wpdb->get_row( $wpdb->prepare( "SELECT ID, post_name, post_parent FROM $wpdb->posts WHERE ID = %d and post_type = %s", $curpage->post_parent, $post_type ));
     2911                        $post_parent = $curpage->post_parent;
     2912                        $curpage = wp_cache_get( $post_parent, 'posts' );
     2913                        if ( false === $curpage )
     2914                                $curpage = $wpdb->get_row( $wpdb->prepare( "SELECT ID, post_name, post_parent FROM $wpdb->posts WHERE ID = %d and post_type = %s", $post_parent, $post_type ) );
    29122915                        $path = '/' . $curpage->post_name . $path;
    29132916                }
    29142917