From c73c23c423a54fd8592368e234733990e2a64169 Mon Sep 17 00:00:00 2001 From: Dominik Schilling Date: Wed, 13 Jul 2016 12:54:28 +0000 Subject: [PATCH] Resource Hints: Increase priority of `wp_resource_hints()` so hints get printed before scripts and styles. Also run `wp_resource_hints()` on the login screen and in the customizer. Props swissspidy. Fixes #37317. Built from https://develop.svn.wordpress.org/trunk@38046 git-svn-id: http://core.svn.wordpress.org/trunk@37987 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/admin-filters.php | 4 +++- wp-includes/default-filters.php | 4 +++- wp-includes/version.php | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/wp-admin/includes/admin-filters.php b/wp-admin/includes/admin-filters.php index 02b49c41eb..65aaccde36 100644 --- a/wp-admin/includes/admin-filters.php +++ b/wp-admin/includes/admin-filters.php @@ -44,7 +44,9 @@ add_action( 'admin_head', 'wp_site_icon' ); add_action( 'admin_head', '_ipad_meta' ); // Prerendering. -add_filter( 'admin_head', 'wp_resource_hints' ); +if ( ! is_customize_preview() ) { + add_filter( 'admin_print_styles', 'wp_resource_hints', 1 ); +} add_action( 'admin_print_scripts-post.php', 'wp_page_reload_on_back_button_js' ); add_action( 'admin_print_scripts-post-new.php', 'wp_page_reload_on_back_button_js' ); diff --git a/wp-includes/default-filters.php b/wp-includes/default-filters.php index b60bee8f44..3402e48ef2 100644 --- a/wp-includes/default-filters.php +++ b/wp-includes/default-filters.php @@ -229,6 +229,7 @@ add_filter( 'rest_authentication_errors', 'rest_cookie_check_errors', 100 ); // Actions add_action( 'wp_head', '_wp_render_title_tag', 1 ); add_action( 'wp_head', 'wp_enqueue_scripts', 1 ); +add_action( 'wp_head', 'wp_resource_hints', 2 ); add_action( 'wp_head', 'feed_links', 2 ); add_action( 'wp_head', 'feed_links_extra', 3 ); add_action( 'wp_head', 'rsd_link' ); @@ -242,7 +243,6 @@ add_action( 'wp_head', 'wp_print_styles', 8 ); add_action( 'wp_head', 'wp_print_head_scripts', 9 ); add_action( 'wp_head', 'wp_generator' ); add_action( 'wp_head', 'rel_canonical' ); -add_action( 'wp_head', 'wp_resource_hints' ); add_action( 'wp_head', 'wp_shortlink_wp_head', 10, 0 ); add_action( 'wp_head', 'wp_site_icon', 99 ); add_action( 'wp_footer', 'wp_print_footer_scripts', 20 ); @@ -256,6 +256,7 @@ if ( isset( $_GET['replytocom'] ) ) add_action( 'wp_head', 'wp_no_robots' ); // Login actions +add_filter( 'login_head', 'wp_resource_hints', 8 ); add_action( 'login_head', 'wp_print_head_scripts', 9 ); add_action( 'login_head', 'print_admin_styles', 9 ); add_action( 'login_head', 'wp_site_icon', 99 ); @@ -416,6 +417,7 @@ add_action( 'wp_enqueue_scripts', 'wp_localize_jquery_ui_datepicker', 1000 ); add_action( 'admin_enqueue_scripts', 'wp_localize_jquery_ui_datepicker', 1000 ); add_filter( 'wp_print_scripts', 'wp_just_in_time_script_localization' ); add_filter( 'print_scripts_array', 'wp_prototype_before_jquery' ); +add_filter( 'customize_controls_print_styles', 'wp_resource_hints', 1 ); add_action( 'wp_default_styles', 'wp_default_styles' ); add_filter( 'style_loader_src', 'wp_style_loader_src', 10, 2 ); diff --git a/wp-includes/version.php b/wp-includes/version.php index 4dd5f51ff6..c01b13fd28 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.6-beta2-38045'; +$wp_version = '4.6-beta2-38046'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.