Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Register Custom Taxonomy Woocommerce Products
// Register Custom Taxonomy
function ess_custom_taxonomy_Item() {
$labels = array(
'name' => 'Brands',
'singular_name' => 'Brand',
'menu_name' => 'Brands',
'all_items' => 'All Brands',
'parent_item' => 'Parent Brand',
'parent_item_colon' => 'Parent Brand:',
'new_item_name' => 'New Brand Name',
'add_new_item' => 'Add New Brand',
'edit_item' => 'Edit Brand',
'update_item' => 'Update Brand',
'separate_items_with_commas' => 'Separate Brand with commas',
'search_items' => 'Search Brands',
'add_or_remove_items' => 'Add or remove Brands',
'choose_from_most_used' => 'Choose from the most used Brands',
);
$args = array(
'labels' => $labels,
'hierarchical' => true,
'public' => true,
'show_ui' => true,
'show_admin_column' => true,
'show_in_nav_menus' => true,
'show_tagcloud' => true,
);
register_taxonomy( 'item', 'product', $args );
}
add_action( 'init', 'ess_custom_taxonomy_item', 0 );
@isandipanmondal

This comment has been minimized.

Copy link

@isandipanmondal isandipanmondal commented Mar 12, 2019

Thank you very much, You save my time.

@esreal12

This comment has been minimized.

Copy link

@esreal12 esreal12 commented Mar 6, 2020

Thank you so much!!! More time saved here.

@MarceloGlez

This comment has been minimized.

Copy link

@MarceloGlez MarceloGlez commented Mar 15, 2020

Thank you very much, I'm a beginner in all of this. Could you tell me how to post it in the product's page?

@tahafarooqui

This comment has been minimized.

Copy link

@tahafarooqui tahafarooqui commented Jun 30, 2020

It is not showing in woocommerce REST API. Is it possible to attach taxonomy in products rest api.

@amit834

This comment has been minimized.

Copy link

@amit834 amit834 commented Nov 2, 2020

how to fetch taxonomy in frontend

@gudh

This comment has been minimized.

Copy link

@gudh gudh commented Jan 14, 2021

Thanks!

and a small update:

register_taxonomy( 'brand', 'product', $args );
@affu44

This comment has been minimized.

Copy link

@affu44 affu44 commented Apr 8, 2021

is this shows on filter like category?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment