diff --git a/packages/block-library/src/post-terms/index.php b/packages/block-library/src/post-terms/index.php index 69d7b04b096b53..60ffdcedf3268f 100644 --- a/packages/block-library/src/post-terms/index.php +++ b/packages/block-library/src/post-terms/index.php @@ -51,13 +51,19 @@ function render_block_core_post_terms( $attributes, $content, $block ) { $suffix = '' . $attributes['suffix'] . '' . $suffix; } - return get_the_term_list( + $post_terms = get_the_term_list( $block->context['postId'], $attributes['term'], wp_kses_post( $prefix ), '' . esc_html( $separator ) . '', wp_kses_post( $suffix ) ); + + if ( is_wp_error( $post_terms ) ) { + return ''; + } + + return $post_terms; } /**