From 75c2147b96086d4d502b652a4a49bdc372bde33f Mon Sep 17 00:00:00 2001 From: George Mamadashvili Date: Fri, 4 Oct 2024 09:19:54 +0400 Subject: [PATCH] Post Terms: Remove unnecessary 'get_the_terms' call (#65867) Co-authored-by: Mamaduka Co-authored-by: aristath --- packages/block-library/src/post-terms/index.php | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/packages/block-library/src/post-terms/index.php b/packages/block-library/src/post-terms/index.php index 60ffdcedf3268..3e7a05f10117e 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 ''; }