Ticket #17670: fix-get_page_by_path-warnings-rewrite.diff
File fix-get_page_by_path-warnings-rewrite.diff, 1.2 KB (added by , 13 years ago) |
---|
-
wp-includes/post.php
3162 3162 $foundid = 0; 3163 3163 foreach ( $pages as $page ) { 3164 3164 if ( $page->post_name == $revparts[0] ) { 3165 $count = 0; 3166 if ( $page->post_parent != 0 ) { 3167 if ( null === ( $parent_page = $pages[ $page->post_parent ] ) ) 3168 continue; 3169 3170 while ( $parent_page->ID != 0 ) { 3171 $count++; 3172 if ( $parent_page->post_name != $revparts[ $count ] ) 3173 break; 3174 $parent_page = $pages[ $parent_page->post_parent ]; 3175 } 3165 if ( 1 == count( $revparts ) ) { 3166 $foundid = $page->ID; 3167 break; 3168 } 3176 3169 3177 if ( $parent_page->ID == 0 && $count+1 == count($revparts) ) { 3178 $foundid = $page->ID; 3170 $cur_page = $page; 3171 $count = 0; 3172 while ( ! empty( $cur_page->post_parent ) && isset( $pages[ $cur_page->post_parent ] ) ) { 3173 if ( $cur_page->post_name != $revparts[ $count ] ) 3179 3174 break; 3180 } 3181 } else if ( count($revparts) == 1 ) { 3175 3176 $cur_page = $pages[ $cur_page->post_parent ]; 3177 $count++; 3178 } 3179 3180 if ( empty( $cur_page->post_parent ) && $count+1 == count($revparts) ) { 3182 3181 $foundid = $page->ID; 3183 3182 break; 3184 3183 }