From 7b0355b5595fc28d57b58d30e07e4b07c6528180 Mon Sep 17 00:00:00 2001 From: Dominik Schilling Date: Wed, 20 Jul 2016 18:19:29 +0000 Subject: [PATCH] Script Loader: Use `dns-prefetch` for the Emoji CDN. * `preconnect` will be potentially pretty heavy on the CDN. With the Unicode 9.0 emoji update, almost all browsers will trigger the `preconnect`. * `preconnect` only opens one connection, but `s.w.org` is HTTP/1.1, so the browser will use the preconnected connection for the first emoji, then it has to open new connections for subsequent emoji. Also use the same URL as we use for the `emoji_svg_url` filter. This will print the hint for the correct CDN in case someone uses a custom CDN. Props peterwilsoncc. Fixes #37387. Built from https://develop.svn.wordpress.org/trunk@38122 git-svn-id: http://core.svn.wordpress.org/trunk@38063 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/general-template.php | 9 ++++++++- wp-includes/version.php | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/wp-includes/general-template.php b/wp-includes/general-template.php index 0b6e576f92..44e87ffd53 100644 --- a/wp-includes/general-template.php +++ b/wp-includes/general-template.php @@ -2802,11 +2802,18 @@ function wp_site_icon() { function wp_resource_hints() { $hints = array( 'dns-prefetch' => wp_dependencies_unique_hosts(), - 'preconnect' => array( 's.w.org' ), + 'preconnect' => array(), 'prefetch' => array(), 'prerender' => array(), ); + /* + * Add DNS prefetch for the Emoji CDN. + * The path is removed in the foreach loop below. + */ + /** This filter is documented in wp-includes/formatting.php */ + $hints['dns-prefetch'][] = apply_filters( 'emoji_svg_url', 'https://s.w.org/images/core/emoji/2/svg/' ); + foreach ( $hints as $relation_type => $urls ) { /** * Filters domains and URLs for resource hints. diff --git a/wp-includes/version.php b/wp-includes/version.php index ca2bb7a322..e6e8997103 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.6-beta3-38121'; +$wp_version = '4.6-beta3-38122'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.