WP_Sitemaps_Index::get_index_url()
Builds the URL for the sitemap index.
Method of the class: WP_Sitemaps_Index{}
No Hooks.
Return
String
. The sitemap index URL.
Usage
$WP_Sitemaps_Index = new WP_Sitemaps_Index(); $WP_Sitemaps_Index->get_index_url();
Notes
- Global. WP_Rewrite. $wp_rewrite WordPress rewrite component.
Changelog
Since 5.5.0 | Introduced. |
WP_Sitemaps_Index::get_index_url() WP Sitemaps Index::get index url code WP 6.4.1
public function get_index_url() { global $wp_rewrite; if ( ! $wp_rewrite->using_permalinks() ) { return home_url( '/?sitemap=index' ); } return home_url( '/wp-sitemap.xml' ); }