diff --git a/packages/block-library/src/comment-author-name/index.php b/packages/block-library/src/comment-author-name/index.php index 41ab4386069e9..04d8e60c65e8c 100644 --- a/packages/block-library/src/comment-author-name/index.php +++ b/packages/block-library/src/comment-author-name/index.php @@ -34,7 +34,7 @@ function render_block_core_comment_author_name( $attributes, $content, $block ) $comment_author = get_comment_author( $comment ); $link = get_comment_author_url( $comment ); - if ( ! empty( $attributes['isLink'] ) && ! empty( $attributes['linkTarget'] ) ) { + if ( ! empty( $link ) && ! empty( $attributes['isLink'] ) && ! empty( $attributes['linkTarget'] ) ) { $comment_author = sprintf( '%3s', esc_url( $link ), esc_attr( $attributes['linkTarget'] ), $comment_author ); } if ( '0' === $comment->comment_approved && ! $show_pending_links ) {