Skip to content

Commit

Permalink
category_description() should be taxonomy-agnostic.
Browse files Browse the repository at this point in the history
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.
Built from https://develop.svn.wordpress.org/trunk@42368


git-svn-id: http://core.svn.wordpress.org/trunk@42197 1a063a9b-81f0-0310-95a4-ce76da25c4cd
  • Loading branch information
boonebgorges committed Dec 4, 2017
1 parent bc76941 commit 39c7daf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
9 changes: 4 additions & 5 deletions wp-includes/category-template.php
Original file line number Diff line number Diff line change
Expand Up @@ -1200,20 +1200,19 @@ function tag_description( $tag = 0 ) {
* Retrieve term description.
*
* @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 string $taxonomy Optional taxonomy name. Defaults to 'post_tag'.
* @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() ) ) {
$term = get_queried_object();
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;
}

Expand Down
2 changes: 1 addition & 1 deletion wp-includes/version.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.0-alpha-42367';
$wp_version = '5.0-alpha-42368';

/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
Expand Down

0 comments on commit 39c7daf

Please sign in to comment.