Exclude Specific Posts From the All in One SEO Sitemap
Keeps the posts and pages you list out of All in One SEO's XML sitemap.
Opens WPIDE on
Code
// IDs to leave out.
$wpide_aioseo_sitemap_exclude = array( 12, 34 );
add_filter( 'aioseo_sitemap_exclude_posts', function ( $ids, $type ) use ( $wpide_aioseo_sitemap_exclude ) {
return array_unique( array_merge( (array) $ids, array_map( 'intval', $wpide_aioseo_sitemap_exclude ) ) );
}, 10, 2 );
Notes
The posts stay indexable; only the sitemap entry is removed.
How to add this snippet
- Install WPIDE on your WordPress site (it is free) and open Code Snippets.
- Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
- It is added inactive: review the code and settings, then switch it on.