Title: Exclude elements from sitemaps
Last modified: May 30, 2022

---

# Exclude elements from sitemaps

 *  Resolved [Marie-Aude](https://wordpress.org/support/users/marie-aude/)
 * (@marie-aude)
 * [4 years ago](https://wordpress.org/support/topic/exclude-elements-from-sitemaps/)
 * Hello,
 * I tried to exclude an array of elements from the sitemap.
    Benjamin Denis directed
   me to the filter seopress_sitemaps_term_single_query bit I can’t make it work.
 * I understood that if modifies the default arguments for the query, so I tried
   this, without any effect :
 *     ```
       function test_seop_exclude_from_sitemap ( $args, $tax ) {
           $args['exclude'] = array(155,987) ;
           return $args ;
           }
       add_filter('seopress_sitemaps_term_single_query', 'test_seop_exclude_from_sitemap', 10, 2);
       ```
   
 * the two terms are still in the sitemap
 * So I went to something even simpler :
 *     ```
       function test_seop_exclude_from_sitemap ( $args, $tax ) {
           $args['number'] = 10 ;
           return $args ;
           }
       add_filter('seopress_sitemaps_term_single_query', 'test_seop_exclude_from_sitemap', 10, 2);
       ```
   
 * I expected to have only 10 terms in my sitemap, and I have all 170.
 * What am I doing wrong ?

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Author [Benjamin Denis](https://wordpress.org/support/users/rainbowgeek/)
 * (@rainbowgeek)
 * [4 years ago](https://wordpress.org/support/topic/exclude-elements-from-sitemaps/#post-15699092)
 * Hi,
 * the correct filter is: `seopress_sitemaps_single_term_query`
 * It should solve the issue 😉
 * [https://www.seopress.org/support/hooks/filter-single-taxonomy-xml-sitemap-query/](https://www.seopress.org/support/hooks/filter-single-taxonomy-xml-sitemap-query/)
 *  Thread Starter [Marie-Aude](https://wordpress.org/support/users/marie-aude/)
 * (@marie-aude)
 * [4 years ago](https://wordpress.org/support/topic/exclude-elements-from-sitemaps/#post-15699795)
 * slapface, feel stupid 🙂 Thanks

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Exclude elements from sitemaps’ is closed to new replies.

 * ![](https://ps.w.org/wp-seopress/assets/icon-128x128.gif?rev=3158903)
 * [SEOPress - AI SEO Plugin & On-site SEO](https://wordpress.org/plugins/wp-seopress/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-seopress/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-seopress/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-seopress/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-seopress/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-seopress/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [Marie-Aude](https://wordpress.org/support/users/marie-aude/)
 * Last activity: [4 years ago](https://wordpress.org/support/topic/exclude-elements-from-sitemaps/#post-15699795)
 * Status: resolved