Last active
September 18, 2021 05:15
-
-
Save bstonedev/71d598218522eec548aead29e6984c8c to your computer and use it in GitHub Desktop.
woocommerce custom product taxonomy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** Season - Custom taxonomy added to product **/ | |
add_action( 'init', 'custom_taxonomy_season' ); | |
function custom_taxonomy_season() { | |
$labels = array( | |
'name' => 'Season', | |
'singular_name' => 'Season', | |
'menu_name' => 'Season', | |
'all_items' => 'All Seasons', | |
'parent_item' => 'Parent Item', | |
'parent_item_colon' => 'Parent Item:', | |
'new_item_name' => 'New Item Name', | |
'add_new_item' => 'Add New Item', | |
'edit_item' => 'Edit Item', | |
'update_item' => 'Update Item', | |
'separate_items_with_commas' => 'Separate Item with commas', | |
'search_items' => 'Search Items', | |
'add_or_remove_items' => 'Add or remove Items', | |
'choose_from_most_used' => 'Choose from the most used Items', | |
); | |
$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( 'activity-season', 'product', $args ); | |
register_taxonomy_for_object_type( 'activity-season', 'product' ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment