WordPress.org

Make WordPress Core

Ticket #8298: 8298.diff

File 8298.diff, 921 bytes (added by technosailor, 5 years ago)
  • wp-includes/post-template.php

     
    659659                        $class = 'class="current_page_item"'; 
    660660                $menu .= '<li ' . $class . '><a href="' . get_option('home') . '">' . $link_before . $text . $link_after . '</a></li>'; 
    661661        } 
     662         
     663        // Because include overrides subpages, we need to reverse engineer the include as exclude 
     664        if( !is_array( $args['included'] ) ) 
     665                $included = (array) $included; 
     666        $pages = get_pages(); 
     667        $exclude = array(); 
     668        foreach( $pages as $page ) 
     669        { 
     670                if( !in_array( $page->ID, $included ) ) 
     671                        $exclude[] = $page->ID; 
     672        } 
    662673 
    663674        $list_args = $args; 
     675        $list_args['exclude'] = $exclude; 
    664676        $list_args['echo'] = false; 
    665677        $list_args['title_li'] = ''; 
    666678        $menu .= str_replace( array( "\r", "\n", "\t" ), '', wp_list_pages($list_args) );