---
title: Filter the urls of each item of a taxonomy XML sitemap
url: "https://www.seopress.org/support/hooks/filter-the-urls-of-each-item-of-a-taxonomy-xml-sitemap/"
lang: en-US
updated: 2021-12-15
hook_name: seopress_sitemaps_term_single_url
required_version: 5.3
---

# Filter the urls of each item of a taxonomy XML sitemap

- **Hook name:** `seopress_sitemaps_term_single_url`
- **Required version:** 5.3

```php
add_filter('seopress_sitemaps_term_single_url', 'sp_sitemaps_term_single_url', 10, 2);
function sp_sitemaps_term_single_url($url, $term)
{
    //do your stuff
    //var_dump($url);
    //array(3) {
    //   ["loc"]=>
    //   string(51) "http://example.com/my-post-category/"
    //   ["mod"]=>
    //   string(25) "2021-12-15T10:15:49+00:00"
    //   ["images"]=>
    //   array(0) {
    //   }
    // }
    return $url;
}
```

Source: [https://gist.github.com/wp-seopress/1d15b4d20bceffaf228219e202a8e984](https://gist.github.com/wp-seopress/1d15b4d20bceffaf228219e202a8e984)



