Exclude Page and Post post types from sitempa
-
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 );
- The topic ‘Exclude Page and Post post types from sitempa’ is closed to new replies.