How to remove dns-prefetch of s.w.org domain

If you want to remove the dns-prefetch of s.w.org, add this code in your functions.php:

 

 

add_filter( 'wp_resource_hints','josem_remove_dns_prefetch',20,2);
function josem_remove_dns_prefetch( $urls, $relation_type ){
	$n = 0;
	$k = false;
	foreach( $urls as $url ){
		if( false !== strpos( $url,'s.w.org' ) ){
			$k = $n;
		}
		++$n;
	}
	if( $k ){
		unset( $urls[$k] );
	}
	return $urls;
}

That’s it!