Last active
September 19, 2018 08:45
-
-
Save gholm/ed070a9c2a197eb301f1df1ca89f897a to your computer and use it in GitHub Desktop.
Remove meta robots, like "noindex" and "nofollow" for the 404 template, from Yoast SEO
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/********* remove 'noindex' from 404 pages *********/ | |
/* Based on this snippet: | |
* https://gist.github.com/amboutwe/0c71e42aa164238007d7ea88f174a93f#file-yoast_seo_robots_remove_search-php | |
*/ | |
add_filter( 'wpseo_robots', 'yoast_seo_robots_remove_404' ); | |
function yoast_seo_robots_remove_404( $robots ) { | |
if ( is_404() ) { | |
return false; | |
} else { | |
return $robots; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This goes in
functions.php
.