How do I remove a page on the sitemap?

#839387
  • Resolved Taylor Merwin
    Rank Math free

    There are at least 7 pages that have been deleted over the past 3 months. However, they are still in the sitemap and I can’t seem to remove them.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Hello,

    I understand your concern about removing deleted pages from the sitemap. To remove deleted pages from the sitemap in Rank Math, you can follow these steps:

    1. Check Sitemap Status: Ensure that the deleted pages are still appearing in the sitemap.
    2. Update Sitemap: If the deleted pages are still in the sitemap, you can try updating the sitemap to see if they get removed automatically.
    3. Manually Exclude: If the above steps don’t work, you can manually exclude the deleted pages by adding the following filter to your theme’s functions.php file:
    add_filter( 'rank_math/sitemap/url', function( $url, $object_id ) {
        // Replace 123 with the ID of the deleted page
        if ( 123 === $object_id ) {
            return false;
        }
        return $url;
    }, 10, 2 );

    By adding this filter, you can exclude specific pages from appearing in the sitemap.

    If you encounter any issues or need further assistance, feel free to reply to this ticket. Thank you for reaching out to us!

    Sources:
    How to Remove Date Snippets from Search Results » Rank Math
    Rank Math Sitemap Issues and Their Fixes » Rank Math
    How To Exclude Rank Math Sitemaps from Caching » Rank Math

    Due to the page being deleted, I can’t get the page ID. Is there another way to find it or do it without the ID?

    Hello,

    Thank you for contacting Rank Math support.

    Please share with us example URLs of the deleted pages that are still in your sitemap so we can investigate this issue for you.

    Thank you for choosing Rank Math

    X

    Hello,

    Have you tried flushing and regenerating your sitemap? If no, please follow these steps to flush and regenerate your sitemap and let us know if it helped.

    Thank you for choosing Rank Math

    Hi there,

    I’ve tried this three times. The pages are still in the sitemap.

    Hello,

    Please exclude the Sitemap files of the Rank Math plugin in your caching plugin. The cache could be via a plugin or from the server. For plugins or Cloudflare, please follow this article:
    https://rankmath.com/kb/exclude-sitemaps-from-caching/

    Then, disable the transient cache for the sitemap by applying this filter. This will make sure that your XML sitemap always reflects the latest changes on your site:

    /** 
     * Filter if XML sitemap transient cache is enabled.
     *
     * @param boolean $unsigned Enable cache or not, defaults to true
     */
    add_filter( 'rank_math/sitemap/enable_caching', '__return_false');

    If you’re not sure how to add this code, you can follow this guide:
    https://rankmath.com/kb/wordpress-hooks-actions-filters/

    If the issue persists, we might need to take a closer look at the settings. Please edit the first post on this ticket and include your WordPress & FTP logins in the designated Sensitive Data section.

    Please do take a complete backup of your website before sharing the information with us.

    Sensitive Data Section

    It is completely secure and only our support staff has access to that section. If you want, you can use the below plugin to generate a temporary login URL to your website and share that with us instead:

    https://wordpress.org/plugins/temporary-login-without-password/

    You can use the above plugin in conjunction with the WP Security Audit Log to monitor what changes our staff might make on your website (if any):

    https://wordpress.org/plugins/wp-security-audit-log/

    We really look forward to helping you.

    Hello,

    Since we did not hear back from you for 15 days, we are assuming that you found the solution. We are closing this support ticket.

    If you still need assistance or any other help, please feel free to open a new support ticket, and we will be more than happy to assist.

    Thank you.

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

The ticket ‘How do I remove a page on the sitemap?’ is closed to new replies.