WordPress.org

Make WordPress Core

Ticket #47678: 47678-walk_category_dropdown_tree.patch

File 47678-walk_category_dropdown_tree.patch, 1.5 KB (added by jrf, 14 months ago)

Simplify & modernize walk_category_dropdown_tree() Includes minor documentation fixes.

  • src/wp-includes/category-template.php

    From dfba0ae9aee8f3defb6f7baea41a41e1a2967505 Mon Sep 17 00:00:00 2001
    From: jrfnl <jrfnl@users.noreply.github.com>
    Date: Thu, 18 Jul 2019 02:32:26 +0200
    Subject: [PATCH] Simplify & modernize walk_category_dropdown_tree()
    
    Includes minor documentation fixes.
    ---
     src/wp-includes/category-template.php | 11 ++++++-----
     1 file changed, 6 insertions(+), 5 deletions(-)
    
    diff --git a/src/wp-includes/category-template.php b/src/wp-includes/category-template.php
    index 2f67df1ec5..7f98ef4a85 100644
    a b function walk_category_tree( ...$args ) { 
    10791079 *
    10801080 * @uses Walker_CategoryDropdown to create HTML dropdown content.
    10811081 * @since 2.1.0
    1082  * @see Walker_CategoryDropdown::walk() for parameters and return description.
     1082 * @see Walker::walk() for parameters and return description.
     1083 *
     1084 * @param mixed ...$args Elements array, maximum hierarchical depth and optional additional arguments.
    10831085 * @return string
    10841086 */
    1085 function walk_category_dropdown_tree() {
    1086         $args = func_get_args();
    1087         // the user's options are the third parameter
     1087function walk_category_dropdown_tree( ...$args ) {
     1088        // The user's options are the third parameter.
    10881089        if ( empty( $args[2]['walker'] ) || ! ( $args[2]['walker'] instanceof Walker ) ) {
    10891090                $walker = new Walker_CategoryDropdown;
    10901091        } else {
    10911092                $walker = $args[2]['walker'];
    10921093        }
    1093         return call_user_func_array( array( $walker, 'walk' ), $args );
     1094        return $walker->walk( ...$args );
    10941095}
    10951096
    10961097//