search ]

Change the Sitemap URL Base in Rank Math

This filter lets you change the URL base of the XML sitemap in Rank Math.

By default, the sitemap is accessible at /sitemap_index.xml. Using the rank_math/sitemap/base_url filter, you can change the base to a different path.

In the example below, the sitemap URL base is changed to search-sitemaps/ instead of the default value.

/**
 * Filter to change the Sitemap URL Base
 *
 * @param string $base New URL Base
 */
add_filter( 'rank_math/sitemap/base_url', function( $base ){
	return 'search-sitemaps/';
}, 10, 1 );
Join the Discussion
0 Comments  ]

Leave a Comment

To add code, use the buttons below. For instance, click the PHP button to insert PHP code within the shortcode. If you notice any typos, please let us know!

Savvy WordPress Development official logo