Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // This snippet adds diagnostic info to your sites <head> html comments
- // If both is_404() & tribe_is_event_query() == true, it will output a noindex meta tag
- // Tribe should be doing this already, but some plugins & themes strip these tags
- // This function further tries to avoid stripping those tags by adding 100 priority to the action
- add_action('wp_head', 'tribe_noindex_on_404', 100);
- function tribe_noindex_on_404() {
- $is_404 = is_404();
- $tribe_is_event_query = tribe_is_event_query();
- $output = '<!-- Tribe Index Test'."\n";
- $output .= 'is_404(): '.($is_404 ? 'true' : 'false')."\n";
- $output .= 'tribe_is_event_query(): '.($tribe_is_event_query ? 'true' : 'false')."\n";
- $output .= '-->'."\n";
- if ( $is_404 && $tribe_is_event_query ) {
- $output .= '<meta name="robot" content="noindex,follow" />' . "\n";
- }
- echo $output;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement