WordPress.org

Make WordPress Core

Ticket #11373: 11373.diff

File 11373.diff, 785 bytes (added by Denis-de-Bernardy, 4 years ago)
  • wp-includes/post.php

     
    21042104                $path = '/' . $leaf_path; 
    21052105                $curpage = $page; 
    21062106                while ($curpage->post_parent != 0) { 
    2107                         $curpage = $wpdb->get_row( $wpdb->prepare( "SELECT ID, post_name, post_parent FROM $wpdb->posts WHERE ID = %d and post_type='page'", $curpage->post_parent )); 
     2107                        $post_parent = $curpage->post_parent; 
     2108                        $curpage = wp_cache_get($post_parent, 'posts'); 
     2109                        if ( $curpage === false) 
     2110                                $curpage = $wpdb->get_row( $wpdb->prepare( "SELECT ID, post_name, post_parent FROM $wpdb->posts WHERE ID = %d and post_type='page'", $post_parent )); 
    21082111                        $path = '/' . $curpage->post_name . $path; 
    21092112                } 
    21102113