diff -r be944660c56a -r 3d72ae0968f4 wp/wp-includes/blocks/site-title.php
--- a/wp/wp-includes/blocks/site-title.php Wed Sep 21 18:19:35 2022 +0200
+++ b/wp/wp-includes/blocks/site-title.php Tue Sep 27 16:37:53 2022 +0200
@@ -21,18 +21,31 @@
$tag_name = 'h1';
$align_class_name = empty( $attributes['textAlign'] ) ? '' : "has-text-align-{$attributes['textAlign']}";
+ $aria_current = is_home() || ( is_front_page() && 'page' === get_option( 'show_on_front' ) ) ? ' aria-current="page"' : '';
+
if ( isset( $attributes['level'] ) ) {
- $tag_name = 0 === $attributes['level'] ? 'p' : 'h' . $attributes['level'];
+ $tag_name = 0 === $attributes['level'] ? 'p' : 'h' . (int) $attributes['level'];
}
- $link = sprintf( '%2$s', get_bloginfo( 'url' ), $site_title );
+ if ( $attributes['isLink'] ) {
+ $link_attrs = array(
+ 'href="' . esc_url( get_bloginfo( 'url' ) ) . '"',
+ 'rel="' . esc_attr( 'home' ) . '"',
+ $aria_current,
+ );
+ if ( '_blank' === $attributes['linkTarget'] ) {
+ $link_attrs[] = 'target="_blank"';
+ }
+ $site_title = sprintf( '%2$s', implode( ' ', $link_attrs ), esc_html( $site_title ) );
+ }
$wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $align_class_name ) );
return sprintf(
'<%1$s %2$s>%3$s%1$s>',
$tag_name,
$wrapper_attributes,
- $link
+ // already pre-escaped if it is a link.
+ $attributes['isLink'] ? $site_title : esc_html( $site_title )
);
}