Opened 4 years ago
Last modified 3 years ago
#52724 new enhancement
Add filters to term label and info values
Reported by: | dingo_d | Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | |
Component: | Taxonomy | Keywords: | dev-feedback 2nd-opinion has-patch |
Focuses: | ui | Cc: |
Description
Inside edit-tags.php
and edit-tag-form.php
label values for term names and descriptions cannot be changed. They can be translated, but that's it.
I propose to add filters to these so that we can change the names of the labels in a specific taxonomy of our liking.
Something like
<div class="form-field form-required term-name-wrap"> <label for="tag-name"><?php echo apply_filters( "{$taxonomy}_term_name_label", _x( 'Name', 'term name' ) ); ?></label> <input name="tag-name" id="tag-name" type="text" value="" size="40" aria-required="true" /> <p><?php _e( 'The name is how it appears on your site.' ); ?></p> </div>
The new filter
<?php apply_filters( "{$taxonomy}_term_name_label", string $name_label )
would allow developers to change these if they have a specific purpose for taxonomies. For instance, you are building a feature where you need many to many relationships, like books and authors, and books are custom post types, while authors are terms in author
taxonomy. Just having a 'Name' is lacking a bit, because you want to put the author's full name (name and surname) as the name of the term.
The same would be for the description and info notices below them. So in total 4 filters:
<?php apply_filters( "{$taxonomy}_term_name_label", string $name_label ) apply_filters( "{$taxonomy}_term_name_info", string $name_label ) apply_filters( "{$taxonomy}_term_description_label", string $name_label ) apply_filters( "{$taxonomy}_term_description_info", string $name_label )
I'll prepare a patch for this.
Added new filters for the labels