Rank Math migration site map issue

#608007
  • Resolved Anonymous
    Rank Math free

    After migrating to Rank Math from Yoast plugin, few links are missing in the sitemap. The links missing are previously added in Yoast by customized code.

    Previous code:
    function add_custom_feedback_sitemap($sitemap_custom_items)
    {
    $sitemap_custom_items = ‘
    <sitemap>
    <loc>https://www.xyz.com/feedback/sitemap-feedback-products.xml</loc&gt;
    <lastmod>2020-12-02T08:02:27-05:00</lastmod>
    </sitemap>
    <sitemap>
    <loc>https://www.xyz.com/feedback/sitemap-feedback-posts.xml</loc&gt;
    <lastmod>2020-12-02T08:02:27-05:00</lastmod>
    </sitemap>’;
    return $sitemap_custom_items;
    }you please share
    // Hook the method to add custom sitemap url
    add_filter(‘wpseo_sitemap_index’, ‘add_custom_feedback_sitemap’);

    I have used rank math hooks like ‘rank_math/sitemap/sitemap_items’, ‘rank_math/sitemap/paths’ and ‘rank_math/sitemap/sitemaps’ but nothing works to add the URLs in rank math sitemap. So, can you please share the valid customized code to add links in sitemap.

    Regards,
    Bharathi Viswa.

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

    Thank you for contacting Rank Math and bringing your concern to our attention. I’m sorry for any inconvenience this issue may have caused you.

    The equivalent of the code you have shared above to include those in the sitemap index is below:

    add_filter( 'rank_math/sitemap/index', function( $xml ) {
    	$xml .= '
    		<sitemap>
    			<loc>https://www.xyz.com/feedback/sitemap-feedback-products.xml</loc>
    			<lastmod>2020-12-02T08:02:27-05:00</lastmod>
    		</sitemap>
    		<sitemap>
    			<loc>https://www.xyz.com/feedback/sitemap-feedback-posts.xml</loc>
    			<lastmod>2020-12-02T08:02:27-05:00</lastmod>
    		</sitemap>';
    		return $xml;
    }, 11 );

    For further adding your custom URLs, you can follow our guide here:
    https://rankmath.com/kb/custom-sitemaps/

    Hope that helps.

    Thank you.

    Anonymous
    Rank Math free

    Hi Reinelle,
    I have added the php code that you have shared, but the xml links are not added in rank math sitemap. I have using plugins ‘Rank Math SEO’ version 1.0.107.3 and ‘Rank Math SEO Pro’ version 3.0.29, is that this versions cause any issues?
    Can you please share further details to add xml links in sitemap?

    Regards,
    Bharathi Viswa.

    Hello,

    The plugin versions you have shared are already outdated. Please update to the latest version to ensure that they are working properly on your site:
    https://rankmath.com/changelog/

    Also, you mentioned that you’re using Rank Math PRO, but the account you used to open this ticket is the Rank Math free version.

    Can you please search and forward a receipt from FastSpring.com or the email address you used to purchase so we can locate your account and verify it?

    Looking forward to helping you.

    Thank 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 3 replies - 1 through 3 (of 3 total)

The ticket ‘Rank Math migration site map issue’ is closed to new replies.