jetpack_sitemap_uri

Absolute URL of the current blog's sitemap.

Description

(string) jetpack_sitemap_uri( (string) $filename = 'sitemap.xml' ); 

Returns (string)

Sitemap URL.

Parameters (1)

0. $filename — Optional. (string) => 'sitemap.xml'
Sitemap file name. Defaults to sitemap.xml,, the initial sitemaps page.

Usage

  1. if ( !function_exists( 'jetpack_sitemap_uri' ) ) { 
  2. require_once '/modules/sitemaps/sitemaps.php'; 
  3.  
  4. // Sitemap file name. Defaults to 'sitemap.xml', the initial sitemaps page. 
  5. $filename = 'sitemap.xml'; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = jetpack_sitemap_uri($filename); 
  9.  

Defined (1)

The function is defined in the following location(s).

/modules/sitemaps/sitemaps.php  
  1. function jetpack_sitemap_uri( $filename = 'sitemap.xml' ) { 
  2. global $wp_rewrite; 
  3.  
  4. $location = Jetpack_Options::get_option_and_ensure_autoload( 'jetpack_sitemap_location', '' ); 
  5.  
  6. if ( $wp_rewrite->using_index_permalinks() ) { 
  7. $sitemap_url = home_url( '/index.php' . $location . '/' . $filename ); 
  8. } elseif ( $wp_rewrite->using_permalinks() ) { 
  9. $sitemap_url = home_url( $location . '/' . $filename ); 
  10. } else { 
  11. $sitemap_url = home_url( $location . '/?jetpack-sitemap=' . $filename ); 
  12.  
  13. /** 
  14. * Filter sitemap URL relative to home URL. 
  15. * @module sitemaps 
  16. * @since 3.9.0 
  17. * @param string $sitemap_url Sitemap URL. 
  18. */ 
  19. return apply_filters( 'jetpack_sitemap_location', $sitemap_url );