context['commentId'] ) ) { return ''; } $comment = get_comment( $block->context['commentId'] ); if ( empty( $comment ) ) { return ''; } $comment_text = get_comment_text( $comment ); if ( ! $comment_text ) { return ''; } $classes = ''; if ( isset( $attributes['textAlign'] ) ) { $classes .= 'has-text-align-' . $attributes['textAlign']; } $wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $classes ) ); return sprintf( '
%2$s
', $wrapper_attributes, $comment_text ); } /** * Registers the `core/comment-content` block on the server. */ function register_block_core_comment_content() { register_block_type_from_metadata( __DIR__ . '/comment-content', array( 'render_callback' => 'render_block_core_comment_content', ) ); } add_action( 'init', 'register_block_core_comment_content' );