Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions src/wp-includes/theme-templates.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,16 @@ function wp_filter_wp_template_unique_post_slug( $override_slug, $slug, $post_ID
*/
function the_block_template_skip_link() {

// Early exit if not an FSE theme.
// Early exit if not a block theme.
if ( ! current_theme_supports( 'block-templates' ) ) {
return;
}

// Early exit if not a block template.
global $_wp_current_template_content;
if ( ! $_wp_current_template_content ) {
return;
}
?>

<?php
Expand Down Expand Up @@ -137,7 +143,12 @@ function the_block_template_skip_link() {

// Get the site wrapper.
// The skip-link will be injected in the beginning of it.
parentEl = document.querySelector( '.wp-site-blocks' ) || document.body,
parentEl = document.querySelector( '.wp-site-blocks' );

// Early exit if the root element was not found.
if ( ! parentEl ) {
return;
}

// Get the skip-link target's ID, and generate one if it doesn't exist.
skipLinkTargetID = skipLinkTarget.id;
Expand Down