Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Fix the_block_template_skip_link() to print style in head#5472

Closed
westonruter wants to merge 5 commits into
WordPress:trunkfrom
westonruter:trac-59505
Closed

Fix the_block_template_skip_link() to print style in head#5472
westonruter wants to merge 5 commits into
WordPress:trunkfrom
westonruter:trac-59505

Conversation

@westonruter

@westonruter westonruter commented Oct 12, 2023

Copy link
Copy Markdown
Member

Trac ticket: https://core.trac.wordpress.org/ticket/59505

Commit Message

Script Loader: Enqueue inline style for block template skip link in head instead of footer.

  • Introduce wp_enqueue_block_template_skip_link() to replace the_block_template_skip_link(). Add to wp_enqueue_scripts action instead of wp_footer.
  • Keep inline script for skip link in footer.
  • Restore original the_block_template_skip_link() from 6.3 and move to deprecated.php.
  • Preserve back-compat for unhooking skip-link by removing the_block_template_skip_link from wp_footer action.

Follow-up to [56682] and [56687].

Props sabernhardt, plugindevs, westonruter, spacedmonkey.
Fixes #59505.
See #58775.
See #58664.


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

Comment thread src/wp-includes/theme-templates.php Outdated
<?php
$skip_link_script = wp_remove_surrounding_empty_script_tags( ob_get_clean() );
$script_handle = 'wp-block-template-skip-link';
wp_register_script( $script_handle, false, array(), false, array( 'in_footer' => 'true' ) );

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops. 🤦

@spacedmonkey spacedmonkey left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good. Marking as ready to commit.

@westonruter

Copy link
Copy Markdown
Member Author

Committed in r56932.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants