Opened 3 years ago
Last modified 2 years ago
#14156 new enhancement
Option to use name, in additon to slug and id in get_term_link() function
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Priority: | low | Milestone: | Future Release |
| Component: | Taxonomy | Version: | 3.0 |
| Severity: | normal | Keywords: | taxonomy, get_term_link, has-patch |
| Cc: | sudar@… |
Description
Right now the get_term_link() function (in wp-includes/taxonomy.php) can be used only with either term id or term slug.
It would be useful to provide an option to add name in addition to term id and slug.
This function inturn uses get_term_by() function and it has the option to provide term name, but the get_term_link() function doesn't have a way to do this.
Attachments (1)
Change History (7)
- Milestone changed from Awaiting Review to 3.1
- Priority changed from normal to low
+1 on the idea.
On the other hand, while I agree that:
get_term_link( 'Term Name', 'taxname', 'name' )
looks better than:
get_term_link( get_term_by( 'name', 'Term Name', 'taxname' ), 'taxname' )
, it's just an implementation detail. get_term_link() shouldn't be concerned with retrieving the correct term.
To avoid passing the taxonomy over and over again, it would be nice if you could do something like this instead:
get_term_by( 'name', 'Term Name', 'taxname' )->get_link()
comment:6
markjaquith — 2 years ago
- Milestone changed from 3.1 to Future Release
To late for enhancements for 3.1.

Path which adds the third parameter to get_term_link function