`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. Merges [42368] to the 4.9 branch. Fixes #42605. See #42771. Built from https://develop.svn.wordpress.org/branches/4.9@42372 git-svn-id: http://core.svn.wordpress.org/branches/4.9@42201 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
c637f0c94f
commit
030f429e78
|
@ -1153,20 +1153,19 @@ function tag_description( $tag = 0 ) {
|
||||||
* Retrieve term description.
|
* Retrieve term description.
|
||||||
*
|
*
|
||||||
* @since 2.8.0
|
* @since 2.8.0
|
||||||
|
* @since 4.9.2 The `$taxonomy` parameter was deprecated.
|
||||||
*
|
*
|
||||||
* @param int $term Optional. Term ID. Will use global term ID by default.
|
* @param int $term Optional. Term ID. Will use global term ID by default.
|
||||||
* @param string $taxonomy Optional taxonomy name. Defaults to 'post_tag'.
|
|
||||||
* @return string Term description, available.
|
* @return string Term description, available.
|
||||||
*/
|
*/
|
||||||
function term_description( $term = 0, $taxonomy = 'post_tag' ) {
|
function term_description( $term = 0 ) {
|
||||||
if ( ! $term && ( is_tax() || is_tag() || is_category() ) ) {
|
if ( ! $term && ( is_tax() || is_tag() || is_category() ) ) {
|
||||||
$term = get_queried_object();
|
$term = get_queried_object();
|
||||||
if ( $term ) {
|
if ( $term ) {
|
||||||
$taxonomy = $term->taxonomy;
|
|
||||||
$term = $term->term_id;
|
$term = $term->term_id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$description = get_term_field( 'description', $term, $taxonomy );
|
$description = get_term_field( 'description', $term );
|
||||||
return is_wp_error( $description ) ? '' : $description;
|
return is_wp_error( $description ) ? '' : $description;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue