diff --git src/wp-includes/general-template.php src/wp-includes/general-template.php
index ca48499..d1a4982 100644
|
|
function wp_site_icon() { |
2795 | 2795 | * |
2796 | 2796 | * These performance improving indicators work by using `<link rel"…">`. |
2797 | 2797 | * |
| 2798 | * TODO - Move Emoji CDN hinting to the JavaScript loader. |
| 2799 | * |
2798 | 2800 | * @since 4.6.0 |
2799 | 2801 | */ |
2800 | 2802 | function wp_resource_hints() { |
2801 | 2803 | $hints = array( |
2802 | 2804 | 'dns-prefetch' => wp_dependencies_unique_hosts(), |
2803 | | 'preconnect' => array( 's.w.org' ), |
| 2805 | 'preconnect' => array(), |
2804 | 2806 | 'prefetch' => array(), |
2805 | 2807 | 'prerender' => array(), |
2806 | 2808 | ); |
2807 | 2809 | |
| 2810 | // Add DNS prefetch for the Emoji CDN. |
| 2811 | // The path is removed in the foreach loop below. |
| 2812 | /** This filter is documented in wp-includes/formatting.php */ |
| 2813 | $hints['dns-prefetch'][] = apply_filters( 'emoji_svg_url', 'https://s.w.org/images/core/emoji/2/svg/' ); |
| 2814 | |
2808 | 2815 | foreach ( $hints as $relation_type => $urls ) { |
2809 | 2816 | /** |
2810 | 2817 | * Filters domains and URLs for resource hints. |
diff --git tests/phpunit/tests/general/resourceHints.php tests/phpunit/tests/general/resourceHints.php
index 95958e7..7546875 100644
|
|
class Tests_WP_Resource_Hints extends WP_UnitTestCase { |
31 | 31 | } |
32 | 32 | |
33 | 33 | function test_should_have_defaults_on_frontend() { |
34 | | $expected = "<link rel='preconnect' href='http://s.w.org'>\n"; |
| 34 | $expected = "<link rel='dns-prefetch' href='//s.w.org'>\n"; |
35 | 35 | |
36 | 36 | $this->expectOutputString( $expected ); |
37 | 37 | |
… |
… |
class Tests_WP_Resource_Hints extends WP_UnitTestCase { |
39 | 39 | } |
40 | 40 | |
41 | 41 | function test_dns_prefetching() { |
42 | | $expected = "<link rel='dns-prefetch' href='//wordpress.org'>\n" . |
| 42 | $expected = "<link rel='dns-prefetch' href='//s.w.org'>\n" . |
| 43 | "<link rel='dns-prefetch' href='//wordpress.org'>\n" . |
43 | 44 | "<link rel='dns-prefetch' href='//google.com'>\n" . |
44 | | "<link rel='dns-prefetch' href='//make.wordpress.org'>\n" . |
45 | | "<link rel='preconnect' href='http://s.w.org'>\n"; |
| 45 | "<link rel='dns-prefetch' href='//make.wordpress.org'>\n"; |
46 | 46 | |
47 | 47 | add_filter( 'wp_resource_hints', array( $this, '_add_dns_prefetch_domains' ), 10, 2 ); |
48 | 48 | |
… |
… |
class Tests_WP_Resource_Hints extends WP_UnitTestCase { |
67 | 67 | } |
68 | 68 | |
69 | 69 | function test_prerender() { |
70 | | $expected = "<link rel='preconnect' href='http://s.w.org'>\n" . |
| 70 | $expected = "<link rel='dns-prefetch' href='//s.w.org'>\n" . |
71 | 71 | "<link rel='prerender' href='https://make.wordpress.org/great-again'>\n" . |
72 | 72 | "<link rel='prerender' href='http://jobs.wordpress.net'>\n" . |
73 | 73 | "<link rel='prerender' href='//core.trac.wordpress.org'>\n"; |
… |
… |
class Tests_WP_Resource_Hints extends WP_UnitTestCase { |
93 | 93 | } |
94 | 94 | |
95 | 95 | function test_parse_url_dns_prefetch() { |
96 | | $expected = "<link rel='dns-prefetch' href='//make.wordpress.org'>\n" . |
97 | | "<link rel='preconnect' href='http://s.w.org'>\n"; |
| 96 | $expected = "<link rel='dns-prefetch' href='//s.w.org'>\n" . |
| 97 | "<link rel='dns-prefetch' href='//make.wordpress.org'>\n"; |
98 | 98 | |
99 | 99 | add_filter( 'wp_resource_hints', array( $this, '_add_dns_prefetch_long_urls' ), 10, 2 ); |
100 | 100 | |
… |
… |
class Tests_WP_Resource_Hints extends WP_UnitTestCase { |
115 | 115 | |
116 | 116 | function test_dns_prefetch_styles() { |
117 | 117 | $expected = "<link rel='dns-prefetch' href='//fonts.googleapis.com'>\n" . |
118 | | "<link rel='preconnect' href='http://s.w.org'>\n"; |
| 118 | "<link rel='dns-prefetch' href='//s.w.org'>\n"; |
119 | 119 | |
120 | 120 | $args = array( |
121 | 121 | 'family' => 'Open+Sans:400', |
… |
… |
class Tests_WP_Resource_Hints extends WP_UnitTestCase { |
134 | 134 | |
135 | 135 | function test_dns_prefetch_scripts() { |
136 | 136 | $expected = "<link rel='dns-prefetch' href='//fonts.googleapis.com'>\n" . |
137 | | "<link rel='preconnect' href='http://s.w.org'>\n"; |
| 137 | "<link rel='dns-prefetch' href='//s.w.org'>\n"; |
138 | 138 | |
139 | 139 | $args = array( |
140 | 140 | 'family' => 'Open+Sans:400', |
… |
… |
class Tests_WP_Resource_Hints extends WP_UnitTestCase { |
151 | 151 | } |
152 | 152 | |
153 | 153 | function test_dns_prefetch_scripts_does_not_included_registered_only() { |
154 | | $expected = "<link rel='preconnect' href='http://s.w.org'>\n"; |
| 154 | $expected = "<link rel='dns-prefetch' href='//s.w.org'>\n"; |
155 | 155 | $unexpected = "<link rel='dns-prefetch' href='//wordpress.org'>\n"; |
156 | 156 | |
157 | 157 | wp_register_script( 'jquery-elsewhere', 'https://wordpress.org/wp-includes/js/jquery/jquery.js' ); |