DNS prefetching will allow 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="//domain.com">
Some common things to use DNS prefetching for is your CDN URL, Google fonts, Google Analytics, etc.
<link rel="dns-prefetch" href="//cdn.domain.com/"> <link rel="dns-prefetch" href="//fonts.googleapis.com/"> <link rel="dns-prefetch" href="//www.google-analytics.com">
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 Perform plugin and adding domains, one per line.
Don’t add the
https://, this way it will resolve no matter the protocol.
Additionally, you need to proactively check the source code and do a quick scan on your WordPress site to ensure that you’re not loading the same DNS prefetch tags twice as some themes might add DNS prefetching for certain things like Google Fonts already.