[wp-trac] [WordPress Trac] #52724: Add filters to term label and info values
WordPress Trac
noreply at wordpress.org
Fri Mar 5 15:22:03 UTC 2021
#52724: Add filters to term label and info values
-------------------------+-------------------------------------------------
Reporter: dingo_d | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Taxonomy | Version:
Severity: normal | Keywords: dev-feedback 2nd-opinion needs-
Focuses: ui | patch
-------------------------+-------------------------------------------------
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
{{{#!php
<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
<?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
<?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.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/52724>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list