Skip to content

Commit

Permalink
update: core post term render issue when term_list returns WP_Error
Browse files Browse the repository at this point in the history
  • Loading branch information
up1512001 committed Oct 3, 2024
1 parent 8e3146f commit 778d76b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/block-library/src/post-terms/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,19 @@ function render_block_core_post_terms( $attributes, $content, $block ) {
$suffix = '<span class="wp-block-post-terms__suffix">' . $attributes['suffix'] . '</span>' . $suffix;
}

return get_the_term_list(
$post_terms = 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 )
);

if ( is_wp_error( $post_terms ) ) {
return false;
}

return $post_terms;
}

/**
Expand Down

0 comments on commit 778d76b

Please sign in to comment.