DEV Community

Cover image for Remove S.W.org DNS prefetch from Wordpress
SeanAUS120
SeanAUS120

Posted on

Remove S.W.org DNS prefetch from Wordpress

Making Wordpress faster is an ongoing experiment. There's a few more things I've discovered which can be removed for small (albeit in this case, VERY small, speed gain). DNS prefetching Google fonts and S.W.org which pulls files from the WP repository.

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

It's as easy as that. We use it here and here.

Top comments (1)

Collapse
 
rboylson profile image
rboylson

Amazing! Thank you for the easy tutorial 🙌