Use code PERFMATTERS for an additional 10% off!

How to Implement DNS Prefetching in WordPress

DNS prefetching allows you to resolve domain names (perform a DNS lookup in the background) before a user clicks on a link, which in turn can help improve performance. It is done by adding a rel=”dns-prefetch” tag in the header of your WordPress site.

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

Some common things to use DNS prefetching for is your CDN URL, Google fonts, Google Analytics, etc.

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

Enable DNS Prefetching in WordPress

DNS-Prefetch is supported by all major browsers, except for iOS Safari, Opera Mini, and Android Browser. You can easily implement DNS prefetching by clicking on the “Extras” tab in the perfmatters plugin and adding domains, one per line. Don’t add the http:// or https://, this way it will resolve no matter the protocol.

dns prefetching
DNS prefetching in WordPress

Also, some themes might add DNS prefetching for certain things like Google Fonts already. You might want to view your source code and do a quick scan just to ensure you aren’t trying to add the tag twice.

Was this article helpful?

Related Articles