[wp-trac] [WordPress Trac] #40090: Walker::display_element does not populate $args[0]->has_children when it is cast as an Object

WordPress Trac noreply at wordpress.org
Fri Mar 10 00:23:41 UTC 2017


#40090: Walker::display_element does not populate $args[0]->has_children when it is
cast as an Object
--------------------------+------------------------------
 Reporter:  JoelStransky  |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Menus         |     Version:  4.7.3
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:
--------------------------+------------------------------

Comment (by JoelStransky):

 Here is a use case
 {{{#!php
 <?php
 add_filter( 'nav_menu_link_attributes', 'filter__nav_menu_link_attributes'
 , 10, 4 );
 function filter__nav_menu_link_attributes ( $atts, $item, $args, $depth )
 {
   if ( $args->has_children ) {  // PHP Notice:  Undefined property:
 stdClass::$has_children
     // modify $atts accordingly
   }
   return $atts;
 }
 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/40090#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list