From 08d4ea89b783f5c8587745964be807666eae7b73 Mon Sep 17 00:00:00 2001 From: Joost de Valk Date: Tue, 9 Apr 2024 20:06:41 +0200 Subject: [PATCH] Update api.md The example was wrong; it would break if you have multiple functions filtering the value as it never returned the initial value of `$excluded`. --- docs/features/xml-sitemaps/api.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/features/xml-sitemaps/api.md b/docs/features/xml-sitemaps/api.md index 1919cf37..47c69c75 100644 --- a/docs/features/xml-sitemaps/api.md +++ b/docs/features/xml-sitemaps/api.md @@ -52,7 +52,10 @@ add_filter( 'wpseo_sitemap_exclude_post_type', 'sitemap_exclude_post_type', 10, * @return bool Whether or not a given taxonomy should be excluded. */ function sitemap_exclude_taxonomy( $excluded, $taxonomy ) { - return $taxonomy === 'ingredients'; + if ( $taxonomy === 'ingredients' ) { + return true; + } + return $excluded; } add_filter( 'wpseo_sitemap_exclude_taxonomy', 'sitemap_exclude_taxonomy', 10, 2 );