[wp-trac] [WordPress Trac] #47806: The get_term_link returns a URL but it's @return and name lead you to believe it's returning an HTML link
WordPress Trac
noreply at wordpress.org
Tue Jul 30 23:06:04 UTC 2019
#47806: The get_term_link returns a URL but it's @return and name lead you to
believe it's returning an HTML link
-----------------------------+-----------------------------
Reporter: garrett-eclipse | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Taxonomy | Version: 2.5
Severity: normal | Keywords:
Focuses: |
-----------------------------+-----------------------------
Hello,
I went to use the `get_term_link` function after reading the
[https://developer.wordpress.org/reference/functions/get_term_link/
documentation] and was confused by it returning a URL and not an HTML link
as it was indicated. The function name also leads you to believe it'll be
a link returned and not a URL.
{{{#!php
<?php
/**
* Generate a permalink for a taxonomy term archive.
*
* @since 2.5.0
*
* @global WP_Rewrite $wp_rewrite
*
* @param object|int|string $term The term object, ID, or slug whose
link will be retrieved.
* @param string $taxonomy Optional. Taxonomy. Default empty.
* @return string|WP_Error HTML link to taxonomy term archive on success,
WP_Error if term does not exist.
*/
function get_term_link( $term, $taxonomy = '' ) {
}}}
I doubt renaming the function is viable due to back-compat but it would be
nice at least to correct the php docblock to indicate the return is a URL
and not an HTML Link.
Thanks
--
Ticket URL: <https://core.trac.wordpress.org/ticket/47806>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list