Created
April 15, 2016 12:12
-
-
Save ms-studio/a48e85d871a3912a9697d66610be1ddc to your computer and use it in GitHub Desktop.
no robots on archive pages
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
<?php | |
// in answer to https://twitter.com/evrenk/status/720939858529796097 | |
// based on http://wordpress.stackexchange.com/questions/86918/ | |
add_action('wp_head', 'no_robots_on_uncategorized_posts'); | |
function no_robots_on_uncategorized_posts() { | |
if ( is_archive() ) { | |
wp_no_robots(); | |
} | |
// Note: is_archive() = When any type of Archive page is being displayed. | |
// Category, Tag, other Taxonomy Term, custom post type archive, Author and Date-based pages are all types of Archives | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment