Skip to content

Instantly share code, notes, and snippets.

@jrstaatsiii
Last active August 24, 2018 14:10
Show Gist options
  • Save jrstaatsiii/a07f0faf661b67923fe4f7dd938e9a24 to your computer and use it in GitHub Desktop.
Save jrstaatsiii/a07f0faf661b67923fe4f7dd938e9a24 to your computer and use it in GitHub Desktop.
<?php
// only no index all events archived
add_action('wp_head', 'no_index_event_archives', 10, 3);
function no_index_event_archives() {
if ( ! is_post_type_archive('tribe_events') )
return;
echo '<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">';
}
// only no index past event archives
add_action('wp_head', 'no_index_paged_event_archives', 10, 3);
function no_index_paged_event_archives() {
if (is_post_type_archive('tribe_events') && is_paged() ) {
echo '<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment