Skip to content

Instantly share code, notes, and snippets.

@vivek-kumar-poddar
Created August 25, 2017 16:09
Show Gist options
  • Save vivek-kumar-poddar/267cfe300c2ff7c8576556eb563c3efa to your computer and use it in GitHub Desktop.
Save vivek-kumar-poddar/267cfe300c2ff7c8576556eb563c3efa to your computer and use it in GitHub Desktop.
https://wpvkp.com/enable-dns-prefetch-wordpress-instant-articles-plugin -- This code will help you to enable dns prefetch in wordpress.
<?php // ************* DON'T COPY ME ***************
/* This is for homepage */
function wpvkp_dnsprefetch_homepage() {
$homepage = get_home_url();
if ( !empty( $homepage ) ) {
echo '<link rel="prefetch" href="'.$homepage.'">
<link rel="prerender" href="'.$homepage.'">';
}
}
add_action( 'wp_head', 'wpvkp_dnsprefetch_homepage', 10 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment