Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions packages/block-library/src/term-description/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,22 @@
*
* @since 5.9.0
*
* @param array $attributes Block attributes.
* @param array $attributes Block attributes.
* @param string $content Block default content.
* @param WP_Block $block Block instance.
*
* @return string Returns the description of the current taxonomy term, if available
*/
function render_block_core_term_description( $attributes ) {
function render_block_core_term_description( $attributes, $content, $block ) {
$term_description = '';

if ( is_category() || is_tag() || is_tax() ) {
// Get term from context or from the current query.
if ( isset( $block->context['termId'] ) && isset( $block->context['taxonomy'] ) ) {
$term = get_term( $block->context['termId'], $block->context['taxonomy'] );
if ( $term && ! is_wp_error( $term ) ) {
$term_description = $term->description;
}
} elseif ( is_category() || is_tag() || is_tax() ) {
$term_description = term_description();
}

Expand Down
Loading