walk_category_tree

The timeline below displays how wordpress function walk_category_tree has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 5.5

//
// Helper functions.
//
/**
 * Retrieves HTML list content for category list.
 *
 * @since 2.1.0
 * @since 5.3.0 Formalized the existing `...$args` parameter by adding it
 *              to the function signature.
 *
 * @uses Walker_Category to create HTML list content.
 * @see Walker::walk() for parameters and return description.
 *
 * @param mixed ...$args Elements array, maximum hierarchical depth and optional additional arguments.
 * @return string
 */
function walk_category_tree(...$args)
{
    // The user's options are the third parameter.
    if (empty($args[2]['walker']) || !$args[2]['walker'] instanceof Walker) {
        $walker = new Walker_Category();
    } else {
        /**
         * @var Walker $walker
         */
        $walker = $args[2]['walker'];
    }
    return $walker->walk(...$args);
}

WordPress Version: 5.4

//
// Helper functions.
//
/**
 * Retrieve HTML list content for category list.
 *
 * @since 2.1.0
 * @since 5.3.0 Formalized the existing `...$args` parameter by adding it
 *              to the function signature.
 *
 * @uses Walker_Category to create HTML list content.
 * @see Walker::walk() for parameters and return description.
 *
 * @param mixed ...$args Elements array, maximum hierarchical depth and optional additional arguments.
 * @return string
 */
function walk_category_tree(...$args)
{
    // The user's options are the third parameter.
    if (empty($args[2]['walker']) || !$args[2]['walker'] instanceof Walker) {
        $walker = new Walker_Category();
    } else {
        $walker = $args[2]['walker'];
    }
    return $walker->walk(...$args);
}

WordPress Version: 5.3

//
// Helper functions
//
/**
 * Retrieve HTML list content for category list.
 *
 * @since 2.1.0
 * @since 5.3.0 Formalized the existing `...$args` parameter by adding it
 *              to the function signature.
 *
 * @uses Walker_Category to create HTML list content.
 * @see Walker::walk() for parameters and return description.
 *
 * @param mixed ...$args Elements array, maximum hierarchical depth and optional additional arguments.
 * @return string
 */
function walk_category_tree(...$args)
{
    // The user's options are the third parameter.
    if (empty($args[2]['walker']) || !$args[2]['walker'] instanceof Walker) {
        $walker = new Walker_Category();
    } else {
        $walker = $args[2]['walker'];
    }
    return $walker->walk(...$args);
}

WordPress Version: 4.3

//
// Helper functions
//
/**
 * Retrieve HTML list content for category list.
 *
 * @uses Walker_Category to create HTML list content.
 * @since 2.1.0
 * @see Walker_Category::walk() for parameters and return description.
 * @return string
 */
function walk_category_tree()
{
    $args = func_get_args();
    // the user's options are the third parameter
    if (empty($args[2]['walker']) || !$args[2]['walker'] instanceof Walker) {
        $walker = new Walker_Category();
    } else {
        $walker = $args[2]['walker'];
    }
    return call_user_func_array(array($walker, 'walk'), $args);
}

WordPress Version: 4.2

//
// Helper functions
//
/**
 * Retrieve HTML list content for category list.
 *
 * @uses Walker_Category to create HTML list content.
 * @since 2.1.0
 * @see Walker_Category::walk() for parameters and return description.
 */
function walk_category_tree()
{
    $args = func_get_args();
    // the user's options are the third parameter
    if (empty($args[2]['walker']) || !$args[2]['walker'] instanceof Walker) {
        $walker = new Walker_Category();
    } else {
        $walker = $args[2]['walker'];
    }
    return call_user_func_array(array(&$walker, 'walk'), $args);
}

WordPress Version: 3.7

//
// Helper functions
//
/**
 * Retrieve HTML list content for category list.
 *
 * @uses Walker_Category to create HTML list content.
 * @since 2.1.0
 * @see Walker_Category::walk() for parameters and return description.
 */
function walk_category_tree()
{
    $args = func_get_args();
    // the user's options are the third parameter
    if (empty($args[2]['walker']) || !is_a($args[2]['walker'], 'Walker')) {
        $walker = new Walker_Category();
    } else {
        $walker = $args[2]['walker'];
    }
    return call_user_func_array(array(&$walker, 'walk'), $args);
}