Skip to content

Instantly share code, notes, and snippets.

@joshfeck
Created July 5, 2019 21:49
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 joshfeck/e3f536564257d0a3d210ae685dfca3ca to your computer and use it in GitHub Desktop.
Save joshfeck/e3f536564257d0a3d210ae685dfca3ca to your computer and use it in GitHub Desktop.
Yoast SEO XML sitemap: remove the single-event archive URL from the sitemap
<?php
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file
function ee_seo_xml_sitemap_no_event_type_single($url, $type, $term) {
if (! isset($term->taxonomy)) {
return $url;
}
if ($term->taxonomy == 'espresso_event_type') {
$url = '';
}
return $url;
}
add_filter(
'wpseo_sitemap_entry',
'ee_seo_xml_sitemap_no_event_type_single',
10,
3
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment