diff --git a/packages/block-library/src/post-terms/index.php b/packages/block-library/src/post-terms/index.php index 60ffdcedf3268f..3e7a05f10117e4 100644 --- a/packages/block-library/src/post-terms/index.php +++ b/packages/block-library/src/post-terms/index.php @@ -24,11 +24,6 @@ function render_block_core_post_terms( $attributes, $content, $block ) { return ''; } - $post_terms = get_the_terms( $block->context['postId'], $attributes['term'] ); - if ( is_wp_error( $post_terms ) || empty( $post_terms ) ) { - return ''; - } - $classes = array( 'taxonomy-' . $attributes['term'] ); if ( isset( $attributes['textAlign'] ) ) { $classes[] = 'has-text-align-' . $attributes['textAlign']; @@ -59,7 +54,7 @@ function render_block_core_post_terms( $attributes, $content, $block ) { wp_kses_post( $suffix ) ); - if ( is_wp_error( $post_terms ) ) { + if ( is_wp_error( $post_terms ) || empty( $post_terms ) ) { return ''; }