WordPress.org

Make WordPress Core

Ticket #17921: curpage-patch.diff

File curpage-patch.diff, 858 bytes (added by adamnbowen, 4 years ago)

the new version of the patch

  • wp-includes/post.php

     
    31753175        foreach ( $pages as $page ) { 
    31763176                $path = '/' . $leaf_path; 
    31773177                $curpage = $page; 
    3178                 while ( $curpage->post_parent != 0 ) { 
     3178                while ( !empty($curpage) && $curpage->post_parent != 0 ) { 
    31793179                        $post_parent = $curpage->post_parent; 
    31803180                        $curpage = wp_cache_get( $post_parent, 'posts' ); 
    31813181                        if ( false === $curpage ) 
    31823182                                $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 ) ); 
    3183                         $path = '/' . $curpage->post_name . $path; 
     3183                        if ( isset($curpage->post_name) ) { 
     3184                                $path = '/' . $curpage->post_name . $path; 
     3185                        } 
    31843186                } 
    31853187 
    31863188                if ( $path == $full_path )