How to Remove DNS-Prefetch WordPress Head?

DNS-Prefetch, also known as DNS-Prefetching, is a technique used by some web browsers to speed up the DNS lookup process in the background.

The DNS lookup process is the background process that uses the Domain Name System (DNS) to translate domain names to IP addresses. In simple words, DNS-Prefetch is used to speed up the DNS lookup process in the background.

The WordPress link on head looks like the following code: 

					<link rel='dns-prefetch' href='//' />

If all of your resources has the same domain yo can disable forcing DNS lookup of specific hostnames. That’s why it’s better to remove this DNS-Prefetch line from your head.

Just copy and paste the following code inside your function.php file. This code will remove the dns-prefetch line from your head area.

					//Remove Dns-prefetch.
remove_action('wp_head', 'wp_resource_hints', 2);

Here is another way to remove DNS prefetch from the header without coding. Install WP Adminify plugin and navigate to Wp Adminify > Tweaks > Head option. Now search for Remove DNS Prefetch option and enable it.

Remove DNS Prefetch
August 27, 2021
Head Tips and Tutorials
Was this article helpful?