Skip to content

Commit

Permalink
Merge pull request #141 from blunce24/updated-sitemap-filter-info-readme
Browse files Browse the repository at this point in the history
Added Filtering Sitemap URL info to plugin Readme
  • Loading branch information
mdbitz authored Jul 10, 2018
2 parents f0d233c + b1fde0d commit 473e83c
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,18 @@ usage: wp msm-sitemap generate-sitemap
See 'wp help msm-sitemap <command>' for more information on a specific command.
```

## Filtering Sitemap URLs

If you need to filter the URLs displayed in a sitemap created via the Comprehensive Sitemap plugin, there are two considerations. First, if you are filtering the individual sitemaps, which display the URLs to the articles published on a specific date, you can use the `msm_sitemap_entry` hook to filter the URLs. An example for a reverse-proxy situation is below:

```
function example_filter_msm_sitemap_entry( $url ) {
$location = str_replace( 'example.wordpress.com', 'example.com/blog', $url->loc );
$url->loc = $location;
return $url;
}
add_filter( 'msm_sitemap_entry', 'example_filter_msm_sitemap_entry', 10, 1 );
```

Second, if you are filtering the root sitemap, which displays the URLs to the individual sitemaps by date, you will need to filter the `home_url` directly. There is no plugin-specific hook to filter the URLs on the root sitemap.

0 comments on commit 473e83c

Please sign in to comment.