Don't do a strict taxonomy check in get_category_link().

Prior to version 4.9, a quirk in the implementation of `get_term()` caused
`get_category_link( 123 )` to fetch the taxonomy archive link for term 123
even if 123 is not in the 'category' taxonomy. The quirk was fixed in [40979];
see #40671. This bugfix introduced a regression for theme authors who were
expecting the old behavior.

By lifting the 'category' restriction, we allow the template function to work
in the old way.

Merges [42364], [42365] to the 4.9 branch.

Fixes #42717. See #42771.

Built from https://develop.svn.wordpress.org/branches/4.9@42369


git-svn-id: http://core.svn.wordpress.org/branches/4.9@42198 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Boone Gorges 2017-12-04 21:55:40 +00:00
parent 2afecbb253
commit edb61cba2e

View File

@ -20,7 +20,7 @@ function get_category_link( $category ) {
if ( ! is_object( $category ) )
$category = (int) $category;
$category = get_term_link( $category, 'category' );
$category = get_term_link( $category );
if ( is_wp_error( $category ) )
return '';