Home / Admin / Exclude a Specific Post from the Sitemap
Duplicate Snippet

Embed Snippet on Your Site

Exclude a Specific Post from the Sitemap

This filter can be used to Exclude a Specific Post from the Sitemap.

Note: Replace 614 with the ID of the post you wish to exclude.

10+
Code Preview
php
<?php
add_filter( 'aioseo_sitemap_exclude_posts', 'aioseo_sitemap_filter_excluded_posts', 10, 2 );
function aioseo_sitemap_filter_excluded_posts( $ids, $type ) {
   if ( 'general' === $type ) {
      $ids[] = 614;
   }
   return $ids;
}

Comments

Add a Comment