Yoast not excluding cpt from sitemap
-
Hi,
We have created a custom post type and for some reasons it has to be set to public. Yet we dont want it to be indexed or showed in the sitemap.
I have used the filter provided on the website:
function sitemap_exclude_post_type( $excluded, $post_type ) { return $post_type === 'my-custom-post-type'; } add_filter( 'wpseo_sitemap_exclude_post_type', 'sitemap_exclude_post_type', 10, 2 );
Somehow, the custom post type is still displayed in the sitemap.
In the Yoast settings, the CPT is available. But i want to exclude it from the sitemap programmatically.
What am i missing here?
Kind regards, Kees
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Yoast not excluding cpt from sitemap’ is closed to new replies.