Skip to contentSkip to main navigation Skip to footer

Remove DNS-Prefetch WordPress

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 ); 
} 

Hide WordPress From Hackers

If you are looking to hide the WordPress CMS from hacker bots download the Hide My WP Ghost plugin. The plugin hides the DNS Prefetch link, Comments, Generator Tag and more.

Learn More