Skip to content

Commit

Permalink
Post Terms: Remove unnecessary 'get_the_terms' call (#65867)
Browse files Browse the repository at this point in the history
Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>
Co-authored-by: aristath <aristath@git.wordpress.org>
  • Loading branch information
3 people authored Oct 4, 2024
1 parent 078a582 commit 75c2147
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions packages/block-library/src/post-terms/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'];
Expand Down Expand Up @@ -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 '';
}

Expand Down

0 comments on commit 75c2147

Please sign in to comment.