• Resolved Marie-Aude

    (@marie-aude)


    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)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Exclude elements from sitemaps’ is closed to new replies.