Notifications
Clear all
Here is my code..............
For search pages, you can remove no index tags from pages and search results....
// ApurbaDa Start //
function wporg_wp_robots_add_follow( $robots ) {
unset( $robots['noindex'] );
//unset( $robots['max-image-preview'] );
//unset( $robots['follow'] );
$robots['follow'] = false;
$robots['max-image-preview'] = false;
return $robots;
}
add_filter( 'wp_robots', 'wporg_wp_robots_add_follow' );
/**
* EDITED BY OBOT ERNEST
* REMOVES NOINDEX META TAG FROM HOME PAGE & SEARCH PAGE IMPLEMENTED BY YOAST
*/
add_filter('wpseo_robots', 'yoast_no_home_noindex', 999);
function yoast_no_home_noindex($string= "") {
if (is_home() || is_front_page() || is_search()) {
$string= "index,follow";
}
return $string;
}
// ApurbaDa End //
Jayanta DK
Topic starter
Posted : 23/09/2022 4:29 pm
Community Forum
We’re currently working on improving our forum experience.
Submit a Guest Post →
We review all submissions before publishing.