Hello,
I have updated the sensitive data as requested. Can you please check further?
Thank you.
Hi William,
Thanks for getting in touch with us.
You can use this filter to add custom URLs to your sitemap: https://rankmath.com/kb/filters-hooks-api-developer/#add-extra-urls-in-sitemap
The fields are pretty self-explanatory. If you still need a hand though, let us know.
Hope that helps and please do not hesitate to let us know if you need our assistance with anything else.
Thank you for the quick response Todd. What is the best Method / the best file to alter? functions.php? Sorry I’m relatively new to this.
Hi William,
Oh, that’s my bad. So sorry.
You have to add that code in your theme’s functions.php file. Add it towards the very end.
Let me know if you need further help with that.
Hello,
I have updated the sensitive data as requested. Can you please check further?
Thank you.
No problem, thanks for the reply again. So I entered the filter into the bottom of theme’s functions.php file yesterday but it’s still not on there. Is there something I need to do to activate it or something?
I added this right before the end.
/**
* 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/{$type}_content’, function() {
});
function rank_math_add_custom_dynamic_url( $urls ) {
$urls .= ‘
https://seo.wjb.marketing/
2019-02-22T18:02:24+00:00
‘;
return $urls;
}
Hi William,
This is the correct code:
/**
* 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://seo.wjb.marketing/</loc>
<lastmod>2019-02-22T18:02:24+00:00</lastmod>
</url>';
});
This will add the link to your page-sitemap.xml
file.
So make sure to delete the cache before you try to find the URL in the sitemap file.
Hope that helps and please do not hesitate to let us know if you need our assistance with anything else.
That fixed it! Thank you so much! Especially for your patients. You’ve been great! I’m going to convert the rest of by clients site over from yoast and when you all make a premium plugin I’ll get it!
Thanks again!
Hello,
We are super happy that this resolved your issue. If you have any other questions in the future, know that we are here to help you.
If you don’t mind me asking, could you please leave us a review (if you haven’t already) on https://wordpress.org/support/plugin/seo-by-rank-math/reviews/#new-post about your overall experience with Rank Math? We appreciate your time and patience.
If you do have another question in the future, please feel free to create a new forum topic, and it will be our pleasure to assist you again.
Thank you.