search ]

Remove DNS Prefetch in WordPress

Making WordPress faster is an ongoing process. One small step with minimal impact is removing DNS prefetching for the following addresses (if you want to remove them):

<link rel='dns-prefetch' href='//s.w.org'/>
<link rel='dns-prefetch' href='//fonts.googleapis.com'/>

In the page source it looks like this:

Removing DNS prefetch loaded automatically by WordPress

To remove these, add the following code to your theme’s functions.php file:

function remove_dns_prefetch () {
    remove_action( 'wp_head', 'wp_resource_hints', 2, 99 );
}
add_action( 'init', 'remove_dns_prefetch' );

If you are not familiar, here is a post explaining what DNS is.

Join the Discussion
0 Comments  ]

Leave a Comment

To add code, use the buttons below. For instance, click the PHP button to insert PHP code within the shortcode. If you notice any typos, please let us know!

Savvy WordPress Development official logo