Remove DNS-Prefetch WordPress
June 7, 2019
What is DNS-Prefetch ?
DNS prefetching is an attempt to resolve domain names before a user tries to follow a link. This is done using the computer’s normal DNS resolution mechanism.
The main reason for rel=dns-prefetch to exist is to speed up the way web pages load when they are using different domains for page resources. This process is often called “DNS prefetching“.
The WordPress link looks like this:
<link rel='dns-prefetch' href='//s.w.org' />
Remove DNS-Prefetch from WordPress site
To remove the DNS-Prefetch link from WordPress wp_head hook is not very hard.
You can add the following code to your functions.php to remove DNS-Prefetch link from your header:
add_action( 'init', 'remove_dns_prefetch' ); function remove_dns_prefetch () { remove_action( 'wp_head', 'wp_resource_hints', 2, 99 ); }