Last active
May 1, 2024 13:27
-
-
Save agusmu/eaedc6f63edbdaf237f2 to your computer and use it in GitHub Desktop.
Customize WooCommerce Categories & 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
/* 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; | |
} |
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
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; | |
} |
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
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; | |
} | |
} |
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
/* 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; | |
} |
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
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; | |
} |
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
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
I found it!