• Resolved pruto

    (@pruto)


    used the code from this thread (below) https://www.ads-software.com/support/topic/exclude-multiple-post-types-from-sitemap/ , but when this setting is disabled : “Show categories in search results” the sitemap breaks get 404 error. How can I make that function to be compatible with that setting being disable? Using that setting the category taxonomy along with the post and page post types won’t show in the sitemap , which is what I want to accomplish.

    function sitemap_exclude_post_type( $excluded, $post_type ) { $excludedPostTypes = array("page", "post"); if (in_array($post_type, $excludedPostTypes)) return true; return false; } add_filter( 'wpseo_sitemap_exclude_post_type', 'sitemap_exclude_post_type', 10, 2 );

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

    (@maybellyne)

    Hello @pruto

    Thanks for using the Yoast SEO plugin. I assume you want to exclude pages and posts from your sitemap. Are you excluding all or some of the posts and pages?

    You mentioned the setting, “Show categories in search results”. Are you also excluding categories from the sitemap?

    It would be helpful if you can provide some more information on what you are trying to achieve.

    Plugin Support Maybellyne

    (@maybellyne)

    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.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Exclude Page and Post post types from sitempa’ is closed to new replies.