--- a/wp/wp-includes/blocks/post-title.php Wed Sep 21 18:19:35 2022 +0200
+++ b/wp/wp-includes/blocks/post-title.php Tue Sep 27 16:37:53 2022 +0200
@@ -19,7 +19,13 @@
return '';
}
- $post_ID = $block->context['postId'];
+ $post_ID = $block->context['postId'];
+ $title = get_the_title();
+
+ if ( ! $title ) {
+ return '';
+ }
+
$tag_name = 'h2';
$align_class_name = empty( $attributes['textAlign'] ) ? '' : "has-text-align-{$attributes['textAlign']}";
@@ -27,9 +33,8 @@
$tag_name = 0 === $attributes['level'] ? 'p' : 'h' . $attributes['level'];
}
- $title = get_the_title( $post_ID );
if ( isset( $attributes['isLink'] ) && $attributes['isLink'] ) {
- $title = sprintf( '<a href="%1s" target="%2s" rel="%3s">%4s</a>', get_the_permalink( $post_ID ), $attributes['linkTarget'], $attributes['rel'], $title );
+ $title = sprintf( '<a href="%1$s" target="%2$s" rel="%3$s">%4$s</a>', get_the_permalink( $post_ID ), esc_attr( $attributes['linkTarget'] ), esc_attr( $attributes['rel'] ), $title );
}
$wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $align_class_name ) );