How to remove DNS Prefetch from WordPress site header

If you are using WordPress for managing your online websites business then you might have noticed DNS-Prefetch that loads in the header of all the WordPress sites right! What it basically do is that it resolves domain names (performs a background check for DNS lookup) before a user clicks on a links that helps improving performance.

Now, question is if DNS-Prefetch improve the performance of a site, why would someone want to remove it lol!

Well, I don’t know but people are looking for it very badly as the search engine results speaks for themselves.

Just add this line of code in your theme’s functions.php file and all the dns-prefetch tags will be removed from your WordPress site’s header file.

remove_action( 'wp_head', 'wp_resource_hints', 2 );

If you don’t want to jump into coding stuff, you can also download and install remove DNS prefetch plugin on your WordPress.

Caution: You should not remove DNS Pre-fetch, you might face performance issues later.

Leave a Reply

Your email address will not be published. Required fields are marked *