-
-
Save marcosnakamine/9f6d1396e9526ae8629df2a12c31ae05 to your computer and use it in GitHub Desktop.
WooCommerce - Custom categories and tags label
This file contains 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 | |
/* Customize Product Categories Labels */ | |
add_filter( 'woocommerce_taxonomy_args_product_cat', 'custom_wc_taxonomy_args_product_cat' ); | |
function custom_wc_taxonomy_args_product_cat( $args ) { | |
$args['label'] = __( 'Product Categories', 'woocommerce' ); | |
$args['labels'] = array( | |
'name' => __( 'Product Categories', 'woocommerce' ), | |
'singular_name' => __( 'Product Category', 'woocommerce' ), | |
'menu_name' => _x( 'Categories', 'Admin menu name', 'woocommerce' ), | |
'search_items' => __( 'Search Product Categories', 'woocommerce' ), | |
'all_items' => __( 'All Product Categories', 'woocommerce' ), | |
'parent_item' => __( 'Parent Product Category', 'woocommerce' ), | |
'parent_item_colon' => __( 'Parent Product Category:', 'woocommerce' ), | |
'edit_item' => __( 'Edit Product Category', 'woocommerce' ), | |
'update_item' => __( 'Update Product Category', 'woocommerce' ), | |
'add_new_item' => __( 'Add New Product Category', 'woocommerce' ), | |
'new_item_name' => __( 'New Product Category Name', 'woocommerce' ) | |
); | |
return $args; | |
} | |
add_filter( 'woocommerce_taxonomy_args_product_cat', 'custom_wc_taxonomy_label_product_cat' ); | |
function custom_wc_taxonomy_label_product_cat( $args ) { | |
$args['label'] = 'My Categories'; | |
$args['labels'] = array( | |
'name' => 'My Categories', | |
'singular_name' => 'My Categories', | |
'menu_name' => 'My Categories' | |
); | |
return $args; | |
} | |
add_action( 'init', 'custom_wc_product_cat_label' ); | |
function custom_wc_product_cat_label() { | |
global $wp_taxonomies; | |
if ( isset( $wp_taxonomies['product_cat'] ) ) { | |
$cat = $wp_taxonomies['product_cat']; | |
$cat->label = 'My Categories'; | |
$cat->labels->singular_name = 'My Category'; | |
$cat->labels->name = $cat->label; | |
$cat->labels->menu_name = $cat->label; | |
} | |
} | |
/* Customize Product Tags Labels */ | |
add_filter( 'woocommerce_taxonomy_args_product_tag', 'custom_wc_taxonomy_args_product_tag' ); | |
function custom_wc_taxonomy_args_product_tag( $args ) { | |
$args['label'] = __( 'Product Tags', 'woocommerce' ); | |
$args['labels'] = array( | |
'name' => __( 'Product Tags', 'woocommerce' ), | |
'singular_name' => __( 'Product Tag', 'woocommerce' ), | |
'menu_name' => _x( 'Tags', 'Admin menu name', 'woocommerce' ), | |
'search_items' => __( 'Search Product Tags', 'woocommerce' ), | |
'all_items' => __( 'All Product Tags', 'woocommerce' ), | |
'parent_item' => __( 'Parent Product Tag', 'woocommerce' ), | |
'parent_item_colon' => __( 'Parent Product Tag:', 'woocommerce' ), | |
'edit_item' => __( 'Edit Product Tag', 'woocommerce' ), | |
'update_item' => __( 'Update Product Tag', 'woocommerce' ), | |
'add_new_item' => __( 'Add New Product Tag', 'woocommerce' ), | |
'new_item_name' => __( 'New Product Tag Name', 'woocommerce' ) | |
); | |
return $args; | |
} | |
add_filter( 'woocommerce_taxonomy_args_product_tag', 'custom_wc_taxonomy_label_product_tag' ); | |
function custom_wc_taxonomy_label_product_tag( $args ) { | |
$args['label'] = 'My Tag'; | |
$args['labels'] = array( | |
'name' => 'My Tag', | |
'singular_name' => 'My Tag', | |
'menu_name' => 'My Tag' | |
); | |
return $args; | |
} | |
add_action( 'init', 'custom_wc_product_tag_label' ); | |
function custom_wc_product_tag_label() { | |
global $wp_taxonomies; | |
if ( isset( $wp_taxonomies['product_tag'] ) ) { | |
$cat = $wp_taxonomies['product_tag']; | |
$cat->label = 'My Tag'; | |
$cat->labels->singular_name = 'My Tag'; | |
$cat->labels->name = $cat->label; | |
$cat->labels->menu_name = $cat->label; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment