Hello,
We apologize for the issue you are facing with your homepage not appearing in the sitemaps generated by Rank Math. To manually include your homepage URL in the sitemap, you can follow these steps:
Step 1: Create a Custom Sitemap File
-
Navigate to WordPress Dashboard → Appearance → Theme File Editor (for Classic Theme) or WordPress Dashboard → Tools → Theme File Editor (for Block Theme).

-
Create a new file in your child theme folder and name it custom-sitemap.php
.
Step 2: Add Code to Custom Sitemap File
- Add the following code to the
custom-sitemap.php
file:
Sources:
How to Create a Custom Sitemap and Include It in Rank Math » Rank Math
Hello,
Your homepage should be automatically added to your sitemap by default, unless it is getting excluded by one of these reasons:
https://rankmath.com/kb/url-not-in-sitemap/
However, here’s a filter you can use and customize to manually add a URL to the sitemap:
/**
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://www.yourwebsite.com/</loc>
<lastmod>2025-04-04T20:20:20+00:00</lastmod>
</url>';
});
And here’s how you can add a filter/hook to your WordPress site:
https://rankmath.com/kb/wordpress-hooks-actions-filters/
Once done, please follow these steps to flush your sitemap cache:
https://i.rankmath.com/pipRDp
Looking 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.