aioseo_sitemap_exclude_posts

Purpose

This filter can be used to filter the posts that are excluded from the sitemap.

Arguments (1)

  1. $ids (array) – The IDs of the excluded posts.
  2. $type (string) – The type of sitemap.

Example code snippet

The code snippet below is just an example of how this filter can be used. In the example below, the post with ID 614 is excluded from the XML Sitemap.

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;
}