diff --git a/src/wp-includes/general-template.php b/src/wp-includes/general-template.php
index 0b6e576f92..44e87ffd53 100644
--- a/src/wp-includes/general-template.php
+++ b/src/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/tests/phpunit/tests/general/resourceHints.php b/tests/phpunit/tests/general/resourceHints.php
index 95958e7f6b..75468758ec 100644
--- a/tests/phpunit/tests/general/resourceHints.php
+++ b/tests/phpunit/tests/general/resourceHints.php
@@ -31,7 +31,7 @@ class Tests_WP_Resource_Hints extends WP_UnitTestCase {
}
function test_should_have_defaults_on_frontend() {
- $expected = "\n";
+ $expected = "\n";
$this->expectOutputString( $expected );
@@ -39,10 +39,10 @@ class Tests_WP_Resource_Hints extends WP_UnitTestCase {
}
function test_dns_prefetching() {
- $expected = "\n" .
+ $expected = "\n" .
+ "\n" .
"\n" .
- "\n" .
- "\n";
+ "\n";
add_filter( 'wp_resource_hints', array( $this, '_add_dns_prefetch_domains' ), 10, 2 );
@@ -67,7 +67,7 @@ class Tests_WP_Resource_Hints extends WP_UnitTestCase {
}
function test_prerender() {
- $expected = "\n" .
+ $expected = "\n" .
"\n" .
"\n" .
"\n";
@@ -93,8 +93,8 @@ class Tests_WP_Resource_Hints extends WP_UnitTestCase {
}
function test_parse_url_dns_prefetch() {
- $expected = "\n" .
- "\n";
+ $expected = "\n" .
+ "\n";
add_filter( 'wp_resource_hints', array( $this, '_add_dns_prefetch_long_urls' ), 10, 2 );
@@ -115,7 +115,7 @@ class Tests_WP_Resource_Hints extends WP_UnitTestCase {
function test_dns_prefetch_styles() {
$expected = "\n" .
- "\n";
+ "\n";
$args = array(
'family' => 'Open+Sans:400',
@@ -134,7 +134,7 @@ class Tests_WP_Resource_Hints extends WP_UnitTestCase {
function test_dns_prefetch_scripts() {
$expected = "\n" .
- "\n";
+ "\n";
$args = array(
'family' => 'Open+Sans:400',
@@ -151,7 +151,7 @@ class Tests_WP_Resource_Hints extends WP_UnitTestCase {
}
function test_dns_prefetch_scripts_does_not_included_registered_only() {
- $expected = "\n";
+ $expected = "\n";
$unexpected = "\n";
wp_register_script( 'jquery-elsewhere', 'https://wordpress.org/wp-includes/js/jquery/jquery.js' );