Create Custom Menu in WordPress Dashboard
Complete tutorial on create custom menu in wordpress dashboard. Discover practical examples, implementation tips, and expert advice for WordPress and WooCo
Read More โExtend WooCommerce product admin filtering using woocommerce_product_filters hook adding custom taxonomy dropdowns. Generate dropdown with wc_product_dropdown_categories function specifying taxonomy like product_tag for tags or custom taxonomies like product_brand, set show_option_none parameter for default dropdown text like "Filter by Tags", assign name parameter matching taxonomy for form submission, retrieve selected value from wp_query->query_vars checking current filter state, append dropdown HTML to existing filters concatenating with $data parameter, add multiple taxonomy filters for comprehensive product organization, enable administrators to filter products by tags, brands, attributes, or custom classifications, and improve product management interface with intuitive filtering options.
WooCommerce provide Many Product filters on admin screen , such as “Select a category”, “Filter by product type”, “Filter by stock status”. For example ,if you want to add Custom filters like “Filter by tags” etc on products admin screen. “Product tag” is a default taxonomies of WooCommerce same as “Product categories”. We can use 'woocommerce_product_filters' filter for adding other texonomy filters too. Paste this code to your theme's functions.php for adding filter to product admin screen.
function CustomTaxonomyFilter( $data ) {
global $wp_query;
$data .= wc_product_dropdown_categories( array(
'show_option_none' => 'Filter by Tags',
'taxonomy' => 'product_tag',
'name' => 'product_tag',
'selected' => isset( $wp_query->query_vars['product_tag'] ) ? $wp_query->query_vars['product_tag'] : '',
) );
return $data;
}
add_filter('woocommerce_product_filters','CustomTaxonomyFilter' );
Same filter can be used for extra custum texomony added.
function CustomTaxonomyFilter( $data ) {
global $wp_query;
$data .= wc_product_dropdown_categories( array(
'show_option_none' => 'Filter by Brands',
'taxonomy' => 'product_brand',
'name' => 'product_brand',
'selected' => isset( $wp_query->query_vars['product_brand'] ) ? $wp_query->query_vars['product_brand'] : '',
) );
return $data;
}
add_filter('woocommerce_product_filters','CustomTaxonomyFilter' );
Search our archives or reach out to our team for solutions and expert advice.