Hello,
Thank you for your query and we are so sorry about the trouble this must have caused.
You shouldn’t remove the lastmod
values from the other sitemaps because that is what makes the sitemaps compliant with Google and other search engines.
If you remove that, it’s possible that the sitemaps can no longer be parsed correctly and the website not crawled consistently.
However, if you want to change it, you can use the following filter:
https://rankmath.com/kb/filters-hooks-api-developer/#remove-lastmod-in-sitemap
Don’t hesitate to get in touch if you have any other questions.
Unfortunately I couldn’t.
Could you please edit and post the code?
Hello,
Please share the sitemap URL and the post type/s where you wanted to remove the lastmod so we can create the filter for you.
Looking forward to helping you.
Thank you.
Thanks,
Custom post type name: products
Taxonomy name: item
Required separately for both taxonomy and post type.
Hello,
Please share your website URL here so we can specifically create a condition that will work on your website’s URL.
In the meantime, you may check the implementation with this example code:
add_filter( 'rank_math/sitemap/index/entry', function( $index, $type ) {
if ( isset( $index['lastmod'] ) && (isset( $index['loc']) && $index['loc'] === 'https://YOURDOMAIN.COM/product-sitemap.xml') ) {
unset( $index['lastmod'] );
}
return $index;
}, 10, 2 );
The YOURDOMAIN.COM
in the URL of the filter code must be changed with your own website domain.
You may refer to this guide on how to add filters to your website: https://rankmath.com/kb/wordpress-hooks-actions-filters/
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.