Skip to content

Instantly share code, notes, and snippets.

@jazzsequence
Created December 2, 2016 19:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jazzsequence/16776cf6817f7d7974af00ffd538f3a1 to your computer and use it in GitHub Desktop.
Save jazzsequence/16776cf6817f7d7974af00ffd538f3a1 to your computer and use it in GitHub Desktop.
Use register_taxonomy_args to rename a taxonomy.
<?php
/**
* Filter the Genre taxonomy and relabel as "Format"
*
* @author Chris Reynolds
* @link https://wordpress.org/support/topic/small-custom-change/
* @uses register_taxonomy_args
* @link https://developer.wordpress.org/reference/hooks/register_taxonomy_args/
*/
function wp_support_rename_genre_taxonomy( $args, $taxonomy_name ) {
if ( $taxonomy === 'genre' ) {
$labels = array(
'name' => __( 'Format', 'yourtextdomain' ),
'singular_name' => __( 'Format', 'yourtextdomain' ),
'search_items' => __( 'Search Formats', 'yourtextdomain' ),
'popular_items' => __( 'Popular Formats', 'yourtextdomain' ),
'all_items' => __( 'All Formats', 'yourtextdomain' ),
'edit_item' => __( 'Edit Format', 'yourtextdomain' ),
'update_item' => __( 'Update Format', 'yourtextdomain' ),
'add_new_item' => __( 'Add New Format', 'yourtextdomain' ),
'new_item_name' => __( 'New Format Name', 'yourtextdomain' ),
'separate_items_ith_commas' => __( 'Separate formats with commas', 'yourtextdomain' ),
'add_or_remove_items' => __( 'Add or remove formats', 'yourtextdomain' ),
'choose_from_most_used' => __( 'Choose from the most used formats', 'yourtextdomain' ),
'not_found' => __( 'No formats found', 'yourtextdomain' ),
'menu_name' => __( 'Formats', 'yourtextdomain' )
);
$args['labels'] = $labels;
}
return $args;
}
add_filter( 'register_taxonomy_args', 'wp_support_rename_genre_taxonomy', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment