wc_walk_category_dropdown_tree( mixed $args )

Custom walker for Product Categories.


Description Description

Previously used by wc_product_dropdown_categories, but wp_dropdown_categories has been fixed in core.


Parameters Parameters

$args

(Required) Variable number of parameters to be passed to the walker.


Top ↑

Return Return

(mixed)


Top ↑

Source Source

File: includes/wc-term-functions.php

function wc_walk_category_dropdown_tree( ...$args ) {
	if ( ! class_exists( 'WC_Product_Cat_Dropdown_Walker', false ) ) {
		include_once WC()->plugin_path() . '/includes/walkers/class-wc-product-cat-dropdown-walker.php';
	}

	// The user's options are the third parameter.
	if ( empty( $args[2]['walker'] ) || ! is_a( $args[2]['walker'], 'Walker' ) ) {
		$walker = new WC_Product_Cat_Dropdown_Walker();
	} else {
		$walker = $args[2]['walker'];
	}

	return $walker->walk( ...$args );
}


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.