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

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

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

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

Source: [https://gist.github.com/wp-seopress/688cbb77df92052f7dd622318b07d559](https://gist.github.com/wp-seopress/688cbb77df92052f7dd622318b07d559)



