Trailing Slash

Viewing 1 replies (of 1 total)
  • Hello,

    Thank you for contacting Rank Math today.

    I am going to go ahead and assume that you want to remove the trailing slash from the links on your sitemap. If this is the case, you can make use of the below code and add it in your functions.php file:

    add_filter( 'rank_math/sitemap/entry', function( $url, $type, $object ){
    	$url['loc'] = untrailingslashit( $url['loc'] );
      return $url;
    }, 10, 3 );

    I hope this info helps. Thank you.

    ​​​​​​

Viewing 1 replies (of 1 total)

You must be logged in to reply to this ticket.