• Resolved macnux

    (@macnux)


    HI,

    I’m trying to modify the sitemap XML tags through the hook?rank_math/sitemap/index
    It doesn’t work.
    I tried also?rank_math/sitemap/entry
    I regenerate the sitemap by changing the links per sitemap and hit save.
    Nothing changed !!

    function modify_sitemap($xml) {

    //modification code here

    }

    add_filter(‘rank_math/sitemap/entry’, ‘modify_sitemap’);

    What is the proper hook to change the sitemap?

    Regards,

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter macnux

    (@macnux)

    I was able to successfully modify the mod date using rank_math/sitemap/url hook, but this hook works only for the inside map:https://localhost/post-sitemap1.xml
    I want to alter the date for the sitemap index itself too:https://localhost/sitemap_index.xml
    What hook is used to edit the sitemap main XML file?

    Plugin Support Rank Math Support

    (@rankmathteam)

    Hello @macnux,

    Thank you for your query and we are so sorry about the trouble this must have caused.

    To ensure that your sitemap is properly updated, please add this filter code in your theme’s functions.php:
    add_filter( 'rank_math/sitemap/enable_caching', '__return_false');

    You may refer to this guide on how to add filters to your website: https://rankmath.com/kb/wordpress-hooks-actions-filters/

    As for the mod date, unfortunately, we don’t have a filter code to modify the date inside the index sitemap. The changing of date, only applies to posts, pages, CPTs, and taxonomies.

    Hope that helps and please do not hesitate to let us know if you need my assistance with anything else.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Sitemap hooks not working’ is closed to new replies.