# List Extra Sitemap Files in Rank Math's Index

> Lists extra sitemap files from other parts of your site in Rank Math's sitemap_index.xml.

- Type: PHP
- Runs: Frontend only
- Category: [Plugin Integrations](https://wpide.com/library/category/integrations/)
- Tags: rank-math, sitemap, index
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/rankmath-sitemap-index-external/

## Code

```php
// Full URLs of extra sitemaps.
$wpide_rm_extra_sitemaps = array(
    home_url( '/shop-sitemap.xml' ),
);

add_filter( 'rank_math/sitemap/index', function ( $xml ) use ( $wpide_rm_extra_sitemaps ) {
    foreach ( $wpide_rm_extra_sitemaps as $url ) {
        $xml .= "\t<sitemap>\n\t\t<loc>" . esc_url( $url ) . "</loc>\n\t\t<lastmod>" . esc_html( gmdate( 'c' ) ) . "</lastmod>\n\t</sitemap>\n";
    }

    return $xml;
}, 11 );
```

## Notes

Use full URLs on the same domain.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "List Extra Sitemap Files in Rank Math's Index" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
