Skip to content
This repository has been archived by the owner on Jan 16, 2024. It is now read-only.

Disable DNS Prefetch for WordPress Emoji (WP 4.6) #159

Merged
merged 1 commit into from Aug 18, 2016

Conversation

chrisatomix
Copy link
Contributor

In WP 4.6 the new DNS Prefetch feature was added. On a typical site it looks like this:

<link rel='dns-prefetch' href='//ajax.googleapis.com'>
<link rel='dns-prefetch' href='//maxcdn.bootstrapcdn.com'>
<link rel='dns-prefetch' href='//s.w.org'>

I was trying to determine where the s.w.org hostname was coming from, and tracked it down to here:
https://core.trac.wordpress.org/attachment/ticket/37387/37387.diff

# src/wp-includes/general-template.php
// 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/' ); 

I've added a single line to the Soil cleanup module to disable this unnecessary DNS prefetch, and I can confirm it worked on my test site. Changing the URL to false seems to be the only way to prevent disable it.
As far as I can tell nothing else in the HEAD has changed in WP 4.6.

@QWp6t
Copy link
Sponsor Member

QWp6t commented Aug 18, 2016

Style check failed because you don't have a space after the comma. If you wanna add that, I'll go ahead and merge this. I'd prefer if you can squash your commits as well, but if you can't/won't, then I can squash when I merge.

@chrisatomix
Copy link
Contributor Author

@QWp6t Oops, sorry about that (got distracted by a team meeting and pushed too early). Should be good now.

@QWp6t QWp6t merged commit d75bfe5 into roots:master Aug 18, 2016
@QWp6t
Copy link
Sponsor Member

QWp6t commented Aug 18, 2016

Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
2 participants