render_block_core_term_description

The timeline below displays how wordpress function render_block_core_term_description has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.2

/**
 * Server-side rendering of the `core/term-description` block.
 *
 * @package WordPress
 */
/**
 * Renders the `core/term-description` block on the server.
 *
 * @param array $attributes Block attributes.
 *
 * @return string Returns the description of the current taxonomy term, if available
 */
function render_block_core_term_description($attributes)
{
    $term_description = '';
    if (is_category() || is_tag() || is_tax()) {
        $term_description = term_description();
    }
    if (empty($term_description)) {
        return '';
    }
    $classes = array();
    if (isset($attributes['textAlign'])) {
        $classes[] = 'has-text-align-' . $attributes['textAlign'];
    }
    if (isset($attributes['style']['elements']['link']['color']['text'])) {
        $classes[] = 'has-link-color';
    }
    $wrapper_attributes = get_block_wrapper_attributes(array('class' => implode(' ', $classes)));
    return '<div ' . $wrapper_attributes . '>' . $term_description . '</div>';
}

WordPress Version: 5.9

/**
 * Server-side rendering of the `core/term-description` block.
 *
 * @package WordPress
 */
/**
 * Renders the `core/term-description` block on the server.
 *
 * @param array $attributes Block attributes.
 *
 * @return string Returns the description of the current taxonomy term, if available
 */
function render_block_core_term_description($attributes)
{
    $term_description = '';
    if (is_category() || is_tag() || is_tax()) {
        $term_description = term_description();
    }
    if (empty($term_description)) {
        return '';
    }
    $extra_attributes = isset($attributes['textAlign']) ? array('class' => 'has-text-align-' . $attributes['textAlign']) : array();
    $wrapper_attributes = get_block_wrapper_attributes($extra_attributes);
    return '<div ' . $wrapper_attributes . '>' . $term_description . '</div>';
}