Deprecated: Function seems_utf8 is deprecated since version 6.9.0! Use wp_is_valid_utf8() instead. in /home/dplugins-code/htdocs/code.dplugins.com/wp-includes/functions.php on line 6131

Deprecated: Function seems_utf8 is deprecated since version 6.9.0! Use wp_is_valid_utf8() instead. in /home/dplugins-code/htdocs/code.dplugins.com/wp-includes/functions.php on line 6131
Exclude posts or taxonomies from sitemap (slimseo) – Code DPlugins

Exclude posts or taxonomies from sitemap (slimseo)

If you are using SlimSeo plugin it automatically add all posts and taxonomies into sitemap.xml file. This snippet allows you to exclude some post types and taxonomies from sitemap file.

add_filter( 'slim_seo_sitemap_post_types', function( $post_types ) {
    $post_types = array_diff( $post_types, ['help','slider']  );
    return $post_types;
} );

add_filter( 'slim_seo_sitemap_taxonomies', function( $taxonomies ) {
    $taxonomies = array_diff( $taxonomies, ['category'] );
    return $taxonomies;
} );

In this snippet above from sitemaps file will exclude ‘help’ and ‘slider’ post type, and ‘category’ taxonomy.

Click to Copy