wp dropdown categories is a very handy function to display categories wherever you want. I use it mostly in the customizer to create options, where it requires users to select a category, perhaps for a post slider. But, sometimes we may was to show categories apart from the blog. Like, WooCommerce Product Categories.
To do so, all we need is the taxonomy created by WooCommerce for Product Categories which is product_cat
After that, we need to use the wp_dropdown_categories( $args ); function like we do, but in the $args , we add one more parameter:
1 2 3 |
$args = array( 'taxonomy' => 'product_cat', ); |
That’s All.