• Resolved kees78

    (@kees78)


    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

    What am i missing here?

    Kind regards, Kees

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support Maybellyne

    (@maybellyne)

    Hello Kees,

    Thanks for using the Yoast SEO plugin. Without the code snippet, does the CPT show in WordPress > Yoast SEO > Settings > Content Types?

    Plugin Support Jose Varghese

    (@josevarghese)

    This thread was marked resolved due to a lack of activity, but you’re always welcome to re-open the topic. Please read this post before opening a new request.

    Thread Starter kees78

    (@kees78)

    Sorry weekend in between. Yes the cpt is showing in the yoast content types. But i want to programmatically exclude it from the sitemap. The function does not prevent this however. How to proceed?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Yoast not excluding cpt from sitemap’ is closed to new replies.