Created
August 25, 2017 16:09
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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