# Leave Chosen Categories Out of the AIOSEO Sitemap

> Removes the category or tag archives you list (by term ID) from All in One SEO's sitemap.

- Type: PHP
- Runs: Frontend only
- Category: [Plugin Integrations](https://wpide.com/library/category/integrations/)
- Tags: aioseo, sitemap, taxonomies
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/aioseo-sitemap-exclude-terms/

## Code

```php
// Term IDs to leave out.
$wpide_aioseo_terms_exclude = array( 5, 9 );

add_filter( 'aioseo_sitemap_exclude_terms', function ( $ids, $type ) use ( $wpide_aioseo_terms_exclude ) {
    return array_unique( array_merge( (array) $ids, array_map( 'intval', $wpide_aioseo_terms_exclude ) ) );
}, 10, 2 );
```

## Notes

Find a term's ID in the edit link on Posts > Categories.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Leave Chosen Categories Out of the AIOSEO Sitemap" 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/
