Make WordPress Core

Ticket #17670: 17670.7.diff

File 17670.7.diff, 1.2 KB (added by duck_, 15 years ago)
  • wp-includes/post.php

     
    31643164        foreach ( (array) $pages as $page ) {
    31653165                if ( $page->post_name == $revparts[0] ) {
    31663166                        $count = 0;
    3167                         if ( $page->post_parent != 0 ) {
    3168                                 if ( null === ( $parent_page = $pages[ $page->post_parent ] ) )
    3169                                         continue;
    3170 
    3171                                 while ( $parent_page->ID != 0 ) {
    3172                                         $count++;
    3173                                         if ( $parent_page->post_name != $revparts[ $count ] )
    3174                                                 break;
    3175                                         $parent_page = $pages[ $parent_page->post_parent ];
    3176                                 }
    3177 
    3178                                 if ( $parent_page->ID == 0 && $count+1 == count($revparts) ) {
    3179                                         $foundid = $page->ID;
     3167                        $p = $page;
     3168                        while ( $p->post_parent != 0 && isset( $pages[ $p->post_parent ] ) ) {
     3169                                $count++;
     3170                                $parent = $pages[ $p->post_parent ];
     3171                                if ( ! isset( $revparts[ $count ] ) || $parent->post_name != $revparts[ $count ] )
    31803172                                        break;
    3181                                 }
    3182                         } else if ( count($revparts) == 1 ) {
     3173                                $p = $parent;
     3174                        }
     3175
     3176                        if ( $p->post_parent == 0 && $count+1 == count( $revparts ) && $p->post_name == $revparts[ $count ] ) {
    31833177                                $foundid = $page->ID;
    31843178                                break;
    31853179                        }