3

How to remove this from WP head:

<link rel='dns-prefetch' href='//maps.google.com'>

I had this also:

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

But, I removed it with this code inside my functions.php

add_filter( 'emoji_svg_url', '__return_false' ); 

Probably, this is added by one plugin exifografy, which can show map of location where image is taken. But, there is just few posts with map, so having this on all URL-s is just one more line of not used HTML code.

4

Resource Hints is a smart feature added to WordPress version 4.6. I think it might improve your site speed. But if you want to disable it, try this:

remove_action('wp_head', 'wp_resource_hints', 2);

References

1
/*
 *  Removes <link rel="prefetch" for WP assets not used in the theme
 * */
function remove_dns_prefetch($hints, $relation_type)
{
    if ('dns-prefetch' === $relation_type) {
        return array_diff(wp_dependencies_unique_hosts(), $hints);
    }
    return $hints;
}

add_filter('wp_resource_hints', 'remove_dns_prefetch', 10, 2);

I would suggest to remove it only if not used in the theme, this is the helper function I'm using

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.