[wp-trac] [WordPress Trac] #24249: wp_page_menu with exclude_tree

WordPress Trac noreply at wordpress.org
Thu May 2 15:18:50 UTC 2013


#24249: wp_page_menu with exclude_tree
--------------------------+-----------------------------
 Reporter:  mike_adaka    |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:
 Severity:  normal        |   Keywords:
--------------------------+-----------------------------
 The param exlude_tree doesn't work with wp_page_menu.

 The issue in wp-includes/post.php

 line 3816

 replace


 {{{
 if ( !empty($exclude_tree) ) {
         $exclude = (int) $exclude_tree;
         $children = get_page_children($exclude, $pages);
         $excludes = array();
         foreach ( $children as $child )
                 $excludes[] = $child->ID;
         $excludes[] = $exclude;
         $num_pages = count($pages);
         for ( $i = 0; $i < $num_pages; $i++ ) {
                 if ( in_array($pages[$i]->ID, $excludes) )
                         unset($pages[$i]);
         }
 }
 }}}


 by


 {{{
 if ( !empty($exclude_tree) ) {
         $list_exclude = explode(",",$exclude_tree);
         $excludes = array();
         foreach ($list_exclude as $exclude)
         {
                 $exclude = (int)$exclude;
                 $children = get_page_children($exclude, $pages);
                 foreach ( $children as $child )
                         $excludes[] = $child->ID;
                 $excludes[] = $exclude;
         }
         $num_pages = count($pages);
         for ( $i = 0; $i < $num_pages; $i++ ) {
                 if ( in_array($pages[$i]->ID, $excludes) )
                         unset($pages[$i]);
         }
 }
 }}}


 Tested and it works with wordpress 3.5.1

 Thanks

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/24249>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list