get_the_term_list example


function get_the_tag_list( $before = '', $sep = '', $after = '', $post_id = 0 ) {
    $tag_list = get_the_term_list( $post_id, 'post_tag', $before$sep$after );

    /** * Filters the tags list for a given post. * * @since 2.3.0 * * @param string $tag_list List of tags. * @param string $before String to use before the tags. * @param string $sep String to use between the tags. * @param string $after String to use after the tags. * @param int $post_id Post ID. */
$prefix = "<div $wrapper_attributes>";
    if ( isset( $attributes['prefix'] ) && $attributes['prefix'] ) {
        $prefix .= '<span class="wp-block-post-terms__prefix">' . $attributes['prefix'] . '</span>';
    }

    $suffix = '</div>';
    if ( isset( $attributes['suffix'] ) && $attributes['suffix'] ) {
        $suffix = '<span class="wp-block-post-terms__suffix">' . $attributes['suffix'] . '</span>' . $suffix;
    }

    return get_the_term_list(
        $block->context['postId'],
        $attributes['term'],
        wp_kses_post( $prefix ),
        '<span class="wp-block-post-terms__separator">' . esc_html( $separator ) . '</span>',
        wp_kses_post( $suffix )
    );
}

/** * Registers the `core/post-terms` block on the server. */
Home | Imprint | This part of the site doesn't use cookies.