rel=”noindex,nofollow” is an HTML attribute that allows you to tell Google and other search engines not to assign any SEO value to certain links. Basically, as the name suggests, it tells Google’s crawling robots not to “follow” or “index” links.
If you need to set to noindex and nofollow download pages in your themes apk likes apkmody, moddroid, apkdone, 5play themes, you can add this small snippet of code to change WordPress SEO behavior.
WordPress SEO has a filter that is triggered right after the robots meta value is calculated. Intercepting this filter and checking the context, we can force noindex (or any other robot directive) on certain pages.
Here are some situations where you might want to use the noindex and nofollow attribute for download pages in APK Themes like apkmody, moddroid, apkdone, 5play themes:
Open your apk themes –> libs –> core –> cores.php remove line 24
after you remove the code, now Open your apk themes –> functions.php and insert this code on end line *this code for Apkmody Themes
###### this code for apkmody themes ######
###### Open your apk themes –> functions.php and insert this code on end line ######
add_filter('wpseo_robots', 'exthemes_no_home_noindex', 999);
function exthemes_no_home_noindex($string= "") {
if ( array_key_exists('download', $GLOBALS['wp_query']->query_vars) ) {
$string= "noindex,nofollow";
}
return $string;
}
if not working. try this second code. *this code for Apkdone, Moddroid and 5play Themes
###### this code for apkdone, 5play and moddroid themes ######
###### Open your apk themes –> functions.php and insert this code on end line ######
function exthemes_no_home_noindex_nofollow() {
global $wp_query;
$noindex = "<meta name='robots' content='noindex,follow' />\n";
if ( ! isset( $wp_query->query_vars['download'] ) || ! is_singular() ) {
return;
}
echo $noindex;
}
add_action( 'wp_head', 'exthemes_no_home_noindex_nofollow',2);
* You can change attribute code rel=”noindex,nofollow” and save. check your download pages now..done
How it works
The wpseo_robots filter is invoked with the current meta robots directive. If the paged condition is verified and we are in the home context or in the archives contexts, we force it to be change to noindex and nofollow.
Note that WordPress SEO, when the robots directive is set to noindex and nofollow removes the canonical.