Manually exclude entry from sitemap

#924002
Viewing 3 replies - 1 through 3 (of 3 total)
  • Hello,

    Thank you for contacting us and bringing your concern to our attention.

    If you want to remove the /events/ page from your sitemap you can apply the following filter on your website:

    add_filter( 'rank_math/sitemap/post_type_archive_link', function( $archive_url, $post_type ){
        if($post_type == 'tribe_events') {
            return false;
        }
        return $archive_url;
    }, 10, 2 );
    

    Here’s how you can add filter/hook to your WordPress site: https://rankmath.com/kb/wordpress-hooks-actions-filters/

    Hope that helps and please don’t hesitate to let us know if you have any other questions.

    Web Infinity
    Rank Math free

    Hi,

    Thanks for the snippet but for some reason, it’s not working. I think it must be another plugin or something.
    It’s weird, I copied the site to a test site, and the /events URL isn’t displaying (even without that snippet).
    So something weird is going on.
    I’ll just leave it in, it’s being 301 to the correct URL anyway, should be fine.

    Thanks for your help.

    Kind regards,
    Robert.

    Hello,

    Sure the 301 redirect should work – but you can also try using this code to exclude the /events/ from your sitemap:

    https://i.rankmath.com/n/MRFOps

    We hope this helps you resolve the issue. Don’t hesitate to contact us again with any other questions or concerns regarding Rank Math. We are always happy to help.

    Thank you for choosing Rank Math!

Viewing 3 replies - 1 through 3 (of 3 total)

You must be logged in to reply to this ticket.