Skip to content

Commit

Permalink
Customize: Begin HTML markup before Customizer script hooks.
Browse files Browse the repository at this point in the history
This prevents printing styles and scripts before the `<!DOCTYPE>`.

The `_wp_admin_html_begin()` function should precede Customizer script hooks, in case a plugin prints markup inside a hook such as `admin_enqueue_scripts`.

Follow-up to [19995], [27907].

Props sabernhardt.
Fixes #62629.

git-svn-id: https://develop.svn.wordpress.org/trunk@59480 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information
SergeyBiryukov committed Dec 2, 2024
1 parent daad863 commit d93b275
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/wp-admin/customize.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,12 @@
$wp_customize->set_autofocus( $autofocus );
}

// Let's roll.
header( 'Content-Type: ' . get_option( 'html_type' ) . '; charset=' . get_option( 'blog_charset' ) );

wp_user_settings();
_wp_admin_html_begin();

$registered = $wp_scripts->registered;
$wp_scripts = new WP_Scripts();
$wp_scripts->registered = $registered;
Expand All @@ -126,12 +132,6 @@
*/
do_action( 'customize_controls_enqueue_scripts' );

// Let's roll.
header( 'Content-Type: ' . get_option( 'html_type' ) . '; charset=' . get_option( 'blog_charset' ) );

wp_user_settings();
_wp_admin_html_begin();

$body_class = 'wp-core-ui wp-customizer js';

if ( wp_is_mobile() ) :
Expand Down

0 comments on commit d93b275

Please sign in to comment.