Skip to content

Commit

Permalink
update taxonomy menu item title
Browse files Browse the repository at this point in the history
  • Loading branch information
ntsekouras committed Jul 15, 2022
1 parent 762c187 commit c3b1f26
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions packages/edit-site/src/components/add-new-template/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,9 @@ export const useTaxonomiesMenuItems = ( onClickMenuItem ) => {
{}
);
const needsUniqueIdentifier = ( labels, slug ) => {
if ( [ 'category', 'post_tag' ].includes( slug ) ) {
return false;
}
const singularName = labels.singular_name.toLowerCase();
return taxonomyLabels[ singularName ] > 1 && singularName !== slug;
};
Expand All @@ -304,15 +307,11 @@ export const useTaxonomiesMenuItems = ( onClickMenuItem ) => {
labels,
slug
);
let menuItemTitle = sprintf(
// translators: %1s: Name of the taxonomy e.g: "Category".
__( 'Taxonomy: %1$s' ),
labels.singular_name
);
let menuItemTitle = labels.singular_name;
if ( _needsUniqueIdentifier ) {
menuItemTitle = sprintf(
// translators: %1s: Name of the taxonomy e.g: "Category"; %2s: Slug of the taxonomy e.g: "product_cat".
__( 'Taxonomy: %1$s (%2$s)' ),
__( '%1$s (%2$s)' ),
labels.singular_name,
slug
);
Expand Down

0 comments on commit c3b1f26

Please sign in to comment.