-
Hello Rank Math Support Team,
I’m using the Rank Math plugin to generate an HTML sitemap for my website, specifically for the page: https://starkbylwax.co.tz/sitemap/.
The issue I’m encountering is that the product titles in the sitemap include HTML tags, and I’d like to strip those tags. I attempted to use the
rank_math/sitemap/entry
filter with the following code in my theme’sfunctions.php
:add_filter( 'rank_math/sitemap/entry', function( $url, $type, $object ) {
if ( $type === 'product' && isset( $url['title'] ) ) {
$url['title'] = wp_strip_all_tags( $url['title'] );
}
return $url;
}, 10, 3 );After adding this code, the product titles in the sitemap still include HTML tags. Could you confirm if this is the correct filter for modifying sitemap entries, or suggest an alternative way to achieve this?
I’d appreciate your guidance on how to resolve this issue.
Thank you!
You must be logged in to reply to this ticket.