• Resolved therock2018

    (@therock2018)


    Hello Developer,
    thanks for you for you amazing job.

    However, I spent different time in searching a way to exclude something from my sitemap

    I just need to list only the post and remove all the other recurrences below:
    wp-sitemap-posts-page-1.xml
    wp-sitemap-posts-erm_menu-1.xml
    wp-sitemap-posts-product-1.xml
    wp-sitemap-posts-xlwcty_thankyou-1.xml
    wp-sitemap-posts-popupbuilder-1.xml
    wp-sitemap-taxonomies-category-1.xml
    wp-sitemap-taxonomies-post_tag-1.xml
    wp-sitemap-taxonomies-product_cat-1.xml
    wp-sitemap-users-1.xml

    Do you have a trick for this?

    Then, my sitemap was:
    sitemap.xml,
    now is wp-sitemap.xml
    I prefer the old version name. Do you have a trick for this too?

    Sorry for all my requests, your plugin is really amazing but its’ my opinion it has some lack of setting for this minor things with the result to lost a lot of time without to fix it.

    Thanks a lot for your help!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Sybre Waaijer

    (@cybr)

    Hello!

    If you’re looking to exclude specific URLs from your sitemap and prefer to use the /sitemap.xml endpoint, I would suggest considering the optimized sitemap of TSF. It can simplify the process for you.

    However, if you prefer not to use TSF’s optimized sitemap (I can’t think of a good reason why), another option is to remove the unwanted sitemaps via code, but note that removing these sitemaps won’t have a direct impact on SEO, so writing and implementing this code won’t be a good way to spend our time.

    Three sitemaps caught my eye: erm_menu, xlwcty_thankyou, and popupbuilder. The plugins that provided these need to fix their misconfigured post types by making them non-public (or by using APIs that better fit the job).

    Still, here’s the snippet that should work until they finally get a chance to fix their code:

    function my_exclude_post_types_from_sitemap( $post_types ) {
    	return array_diff( $post_types, [ 'erm_menu', 'xlwcty_thankyou', 'popupbuilder' ] );
    }
    add_filter( 'wp_sitemaps_post_types', 'my_exclude_post_types_from_sitemap' );

    The WordPress Core sitemap’s endpoint (/wp-sitemap(-*)?.xml) is hardcoded in WordPress and can’t be changed.

    I advise against spending excessive time on sitemaps within WordPress, even if your site has more than 500 pages. Sitemaps on WordPress don’t provide significant SEO benefits. If you’re interested, you can learn more about this topic here: https://tsf.fyi/kb/sitemap. Excuse my irreverence in that article.

    Let me know if you require further assistance. Cheers!

    Thread Starter therock2018

    (@therock2018)

    Thanks a lot for the time you’ve spend to answer me.
    I followed all of your tips and now everything is fine.
    For that reason I decided to install your plugin on another my website.
    Thanks a lot for what you are doing for us. Cheers.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Sitemap Exclusion’ is closed to new replies.