• Resolved therock2018

    (@therock2018)


    Hi, I would to like to give a chance to your plugin.

    I am looking for something light and fast. Tell me, it’s possible to exclude some categories, tags, etc on the XML sitemap? I see that plugin shows everything.

    I just need to list posts only.
    Thanks a lot and thanks for what you are doing.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Anh Tran

    (@rilwis)

    Hi @therock2018 ,

    Yes, you can to exclude taxonomies and terms from the XML sitemap. To exclude taxonomies, please add the following snippet to your theme’s functions.php file:

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

    If you want to remove all taxonomies, please use this snippet:

    add_filter( 'slim_seo_sitemap_taxonomies', '__return_empty_array' );

    To exclude some terms, you can change the term query as follows:

    add_filter( 'slim_seo_taxonomy_query_args', function( $query_args ) {
        $query_args['exclude'] = '12,34';
    } );
    Thread Starter therock2018

    (@therock2018)

    Hi, thanks a lot for your reply.
    Listen, I am probably much more stupid than I think!.
    I tried different combinations without to fix it

    The plugin show this list
    mydomain/sitemap-post-type-post.xml
    mydomain/sitemap-post-type-page.xml
    mydomain/sitemap-post-type-erm_menu.xml
    mydomain/sitemap-taxonomy-category.xml

    I just need this one: mydomain/sitemap-post-type-post.xml
    Some more tips?

    Thanks and sorry for all.

    Plugin Author Anh Tran

    (@rilwis)

    Hi @therock2018 ,

    We have filters for you to remove taxonomies sitemaps. In this case, if you want to keep only post, please use this snippet:

    // Remove all taxonomies.
    add_filter( 'slim_seo_sitemap_taxonomies', '__return_empty_array' );
    add_filter( 'slim_seo_sitemap_post_types', function() {
        return ['post'];
    } );
    Thread Starter therock2018

    (@therock2018)

    Hi Anh,
    Works like a charm!

    Thanks a lot, for all.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘XML Sitemap (excluding something from)’ is closed to new replies.