Customizing CPT-onomy Labels

Filter added in version 1.3.4.

By default, a CPT-onomy’s labels are set to match the custom post type’s labels. You can use the ‘custom_post_type_onomies_cpt_onomy_labels’ filter to change these default labels.

You can learn more about the default taxonomy labels in the Codex.

Some need-to-knows about filters:

  • To use this filter, tweak the code below and add it to your functions.php file.
  • If a filter accepts more than one argument, you have to declare the number of arguments in your add_filter() declaration, along with the filter’s priority.
  • All filters MUST return a value, i.e. the value being filtered.
  • For more information, check out add_filter() in the WordPress codex.

Change a specific CPT-onomy’s labels

<?php
add_filter( 'custom_post_type_onomies_cpt_onomy_labels', 'my_website_change_cpt_onomy_labels', 1, 3 );
function my_website_change_cpt_onomy_labels( $cpt_onomy_labels, $cpt_onomy_name, $custom_post_type ) {
   if ( $cpt_onomy_name == 'movies' )
      $cpt_onomy_labels[ 'separate_items_with_commas' ] = 'Separate films with lots of commas';
   return $cpt_onomy_labels;
}
?>