How to disable optional parameters in the sitemap?

#418995
  • Resolved Bender Log
    Rank Math free

    Hi,
    How to disable optional <lastmod> parameters in sitemap.xml?
    Thanks in advance for your reply.

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

    Thank you for reaching out to us and bringing your concern to our attention.

    Can you please confirm if you wish to totally remove the Last Mod. column?

    lastmod

    At the moment, we don’t have an option to remove it via our plugin settings.

    Looking forward to helping you on this one.

    Yes, I want these <lastmod>2022-01-01</lastmod> parameters to not show up in the sitemap.
    This option is useful when information changes frequently (shops, news).
    Thanks for the quick response.

    Hello,

    Allow me to check this one with our dev team and see if this is possible. We should get back to you shortly.

    We appreciate your time and patience on this one.

    Thank you.

    Hello,

    I just got word from our dev team and provided me the filter to remove the said parameters. Kindly refer to this filter:

    add_filter( 'rank_math/sitemap/entry', function( $url, $type, $object ){
    	if ( isset( $url['mod'] ) ) {
    		unset( $url['mod'] );
    	}
    
    	return $url;
    }, 10, 3 );

    Here is a guide you can follow to add the filter:
    https://rankmath.com/kb/wordpress-hooks-actions-filters/

    After applying the filter, please follow this video guide: https://i.rankmath.com/pipRDp

    Please note that this will only remove the XML element <lastmod> and the column “Last Mod.” should retain. This is because our sitemap page is stylized this way but Search Engine should not be able to see the lastmod anymore.

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

    Thanks a lot, everything worked out! Do I understand correctly that the actions shown in the video file are necessary to update the configuration?

    One more moment. Is it possible to do the same one level higher (see screenshot)

    Hello,

    Thanks a lot, everything worked out! Do I understand correctly that the actions shown in the video file are necessary to update the configuration?

    Usually, in a WordPress environment, the sitemaps are heavily cached so if you do any changes or any configuration in your sitemap cache, you may follow the steps from that video. If the sitemap was updated on your end right away after applying the filter, you can go ahead and ignore the video I shared.

    Is it possible to do the same one level higher

    Unfortunately, the filter I shared only focused on sitemap URL entries, not the sitemap pages themselves and we currently don’t have any filter for that.

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

    Hello,
    I hope this helps to make the robot crawl pages more often ))
    Thanks

    Hello,

    Let us know how it goes.

    Meanwhile, if you have any other questions, please feel free to ask.

    We are here to help 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 9 replies - 1 through 9 (of 9 total)

The ticket ‘How to disable optional parameters in the sitemap?’ is closed to new replies.