WordPress.org

Make WordPress Core

Ticket #39862: 39862.3.diff

File 39862.3.diff, 915 bytes (added by welcher, 3 years ago)
  • src/wp-includes/class-wp-walker.php

    diff --git src/wp-includes/class-wp-walker.php src/wp-includes/class-wp-walker.php
    index abc99ce..124366d 100644
    class Walker { 
    4848        public $has_children;
    4949
    5050        /**
     51         * Total children of current element.
     52         *
     53         * @since 4.7.2
     54         * @var int
     55         */
     56        public $total_children;
     57
     58        /**
    5159         * Starts the list before the elements are added.
    5260         *
    5361         * The $args parameter holds additional values that may be used with the child
    class Walker { 
    141149                if ( isset( $args[0] ) && is_array( $args[0] ) ) {
    142150                        $args[0]['has_children'] = $this->has_children; // Back-compat.
    143151                }
     152               
     153                if ( $this->has_children ) {
     154                        $this->total_children = count( $children_elements[ $id ] );
     155                }
    144156
    145157                $cb_args = array_merge( array(&$output, $element, $depth), $args);
    146158                call_user_func_array(array($this, 'start_el'), $cb_args);