WordPress.org

Make WordPress Core

Ticket #21534: has_children.patch

File has_children.patch, 623 bytes (added by betzster, 3 years ago)

Check if $args[0] is an object, and also set has_children in that case.

  • wp-includes/class-wp-walker.php

     
    125125                //display this element 
    126126                if ( is_array( $args[0] ) ) 
    127127                        $args[0]['has_children'] = ! empty( $children_elements[$element->$id_field] ); 
     128                else if ( is_object( $args[0] ) ) 
     129                        $args[0]->has_children = ! empty( $children_elements[$element->$id_field] ); 
    128130                $cb_args = array_merge( array(&$output, $element, $depth), $args); 
    129131                call_user_func_array(array(&$this, 'start_el'), $cb_args); 
    130132