Make WordPress Core

Changeset 42368


Ignore:
Timestamp:
12/04/2017 09:48:24 PM (6 years ago)
Author:
boonebgorges
Message:

category_description() should be taxonomy-agnostic.

This change reinstates the previous de facto behavior of category_description().
See [40979], [42364]. Because term_description() no longer passes $taxonomy to
get_term_field(), the parameter is no longer needed and has been deprecated.

Fixes #42605. See #42771.

Location:
trunk
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/category-template.php

    r42367 r42368  
    12011201 *
    12021202 * @since 2.8.0
     1203 * @since 4.9.2 The `$taxonomy` parameter was deprecated.
    12031204 *
    12041205 * @param int $term Optional. Term ID. Will use global term ID by default.
    1205  * @param string $taxonomy Optional taxonomy name. Defaults to 'post_tag'.
    12061206 * @return string Term description, available.
    12071207 */
    1208 function term_description( $term = 0, $taxonomy = 'post_tag' ) {
     1208function term_description( $term = 0 ) {
    12091209    if ( ! $term && ( is_tax() || is_tag() || is_category() ) ) {
    12101210        $term = get_queried_object();
    12111211        if ( $term ) {
    1212             $taxonomy = $term->taxonomy;
    1213             $term     = $term->term_id;
    1214         }
    1215     }
    1216     $description = get_term_field( 'description', $term, $taxonomy );
     1212            $term = $term->term_id;
     1213        }
     1214    }
     1215    $description = get_term_field( 'description', $term );
    12171216    return is_wp_error( $description ) ? '' : $description;
    12181217}
Note: See TracChangeset for help on using the changeset viewer.