Skip to content

Instantly share code, notes, and snippets.

@gerard-kanters
Created January 6, 2021 13:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gerard-kanters/b6e7f01efa761339647204cb691375c6 to your computer and use it in GitHub Desktop.
Save gerard-kanters/b6e7f01efa761339647204cb691375c6 to your computer and use it in GitHub Desktop.
Filter for Yoas SEO with Wordpress to index internal search pages. Add this in functions.php of your theme.
//Let Google index search pages, otherwise following links will also stop
function index_search_robots ($robots) {
if ( is_search() ) {
return 'index,follow';
}
return $robots;
}
add_filter( 'wpseo_robots', 'index_search_robots' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment