The search page header of WordPress has this meta:
<meta name=’robots’ content=’noindex, follow, max-image-preview:large’ />
How to remove this tag when it causes search engines to not index this page?
This code is not in header.php, nor is it in the theme file. It is in the WordPress internal file, but it is generated by the theme through<?php wp_head(); ?> This function is called and cannot be changed in the theme.
Although we cannot change this function, we can remove the built-in function that we do not need from the template file.
Removal noindex method:
Find the functions.php file in the theme file and then search for add_ There are many functions in the filter function, functions. PHP. Find any one and add the following code nearby:
add_filter(‘wp_robots’, ‘fanly_basic_robots_remove_noindex’, 999);
function fanly_basic_robots_remove_noindex( $robots ){
return get_option(‘blog_public’) ? [] : $robots;
}
After saving the functions.php file and refreshing the webpage, the meta functions of the entire robots will disappear. All WordPress pages on the entire website will no longer have this meta tag.