Make WordPress Core

Changeset 42369


Ignore:
Timestamp:
12/04/2017 09:54:15 PM (8 years ago)
Author:
boonebgorges
Message:

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.

Location:
branches/4.9
Files:
2 edited
1 copied

Legend:

Unmodified
Added
Removed
  • branches/4.9

  • branches/4.9/src/wp-includes/category-template.php

    r41767 r42369  
    2121        $category = (int) $category;
    2222
    23     $category = get_term_link( $category, 'category' );
     23    $category = get_term_link( $category );
    2424
    2525    if ( is_wp_error( $category ) )
  • branches/4.9/tests/phpunit/tests/category/getCategoryLink.php

    r42364 r42369  
    1818     * @ticket 42771
    1919     */
    20     public function test_should_return_link_for_term_from_another_category_on_primed_cache() {
     20    public function test_should_return_link_for_term_from_another_taxonomy_on_primed_cache() {
    2121        register_taxonomy( 'wptests_tax', 'post' );
    2222
     
    3737     * @ticket 42771
    3838     */
    39     public function test_should_return_link_for_term_from_another_category_on_empty_cache() {
     39    public function test_should_return_link_for_term_from_another_taxonomy_on_empty_cache() {
    4040        register_taxonomy( 'wptests_tax', 'post' );
    4141
Note: See TracChangeset for help on using the changeset viewer.