How to set custom url in sitemap.

#237618
Viewing 5 replies - 1 through 5 (of 5 total)
  • Hello,

    Thank you for contacting Rank Math.

    You can use our filter hooks to add custom URLs in the Sitemap. You can see the code snippet in the following link:
    Add extra URLs in Sitemap

    The code should be added to your theme’s functions.php file.

    Please let us know how that goes. We are here if you need us again.

    Thank you

    /**
    Filter to add extra URLs to the XML sitemap by type.
    *
    Only runs for the first page, not on all.
    *
    @param string $content String content to add, defaults to empty.
    */
    add_action( ‘rank_math/sitemap/page_content’, function() {
    return ‘<url>
    <loc>https://staging2.roger.com/slots/</loc&gt;
    <lastmod>2021-06-10T20:20:20+00:00</lastmod>
    </url>’;
    });

    we have add this code in functions.php. but url is not showing in sitemap

    Hello,

    Can you please follow these steps?

    1. Flush the Sitemap cache by following this video screencast:
    https://i.rankmath.com/pipRDp

    2. 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/

    See if that updates the sitemap page.

    We are looking forward to helping you.

    Again Url is not showing.

    CODE :-
    add_action( ‘rank_math/sitemap/page_content’, function() {
    return ‘<url>
    <loc>https://staging2.roger.com/slots/</loc&gt;
    <lastmod>2021-06-10T20:20:20+00:00</lastmod>
    </url>’;
    });

    Url of sitemap :- https://staging2.roger.com/page-sitemap.xml

    Note :- This Site is password protected.

    Hello,

    Could you please share the username and password for your website?

    If you prefer, we might need to take a closer at your WP admin dashboard. Please edit the first post on this ticket and include your WordPress login 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.

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

You must be logged in to reply to this ticket.