WordPress search page noindex header meta removal method

The search page of the WordPress system has a meta tag, which causes search engines such as Google not to index the search page.

The solution is also very simple, find the functions.php file in the WordPress theme folder, and then add the following code near the add_filter, refresh it, and the robots tag of the search page will disappear:

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 and refreshing, the in the header of the page will disappear, and Google will index the search page.

Original link

0 comment AAuthor MAdministrators
    No Comments Yet. Be the first to share what you think!
Profile
Check-in
Message Message
Search