Warning: Cannot modify header information - headers already sent by (output started at /home/destefa1/public_html/nf/function.php:1) in /home/destefa1/public_html/nf/function.php on line 215
Warning: Cannot modify header information - headers already sent by (output started at /home/destefa1/public_html/nf/function.php:1) in /home/destefa1/public_html/nf/function.php on line 216
Warning: Cannot modify header information - headers already sent by (output started at /home/destefa1/public_html/nf/function.php:1) in /home/destefa1/public_html/nf/function.php on line 217
Warning: Cannot modify header information - headers already sent by (output started at /home/destefa1/public_html/nf/function.php:1) in /home/destefa1/public_html/nf/function.php on line 218
Warning: Cannot modify header information - headers already sent by (output started at /home/destefa1/public_html/nf/function.php:1) in /home/destefa1/public_html/nf/function.php on line 219
Warning: Cannot modify header information - headers already sent by (output started at /home/destefa1/public_html/nf/function.php:1) in /home/destefa1/public_html/nf/function.php on line 220
registry = $registry;
}
/**
* Gets a sitemap list for the index.
*
* @since 5.5.0
*
* @return array[] Array of all sitemaps.
*/
public function get_sitemap_list() {
$sitemaps = array();
$providers = $this->registry->get_providers();
/* @var WP_Sitemaps_Provider $provider */
foreach ( $providers as $name => $provider ) {
$sitemap_entries = $provider->get_sitemap_entries();
// Prevent issues with array_push and empty arrays on PHP < 7.3.
if ( ! $sitemap_entries ) {
continue;
}
// Using array_push is more efficient than array_merge in a loop.
array_push( $sitemaps, ...$sitemap_entries );
if ( count( $sitemaps ) >= $this->max_sitemaps ) {
break;
}
}
return array_slice( $sitemaps, 0, $this->max_sitemaps, true );
}
/**
* Builds the URL for the sitemap index.
*
* @since 5.5.0
*
* @global WP_Rewrite $wp_rewrite WordPress rewrite component.
*
* @return string The sitemap index URL.
*/
public function get_index_url() {
global $wp_rewrite;
if ( ! $wp_rewrite->using_permalinks() ) {
return home_url( '/?sitemap=index' );
}
return home_url( '/wp-sitemap.xml' );
}
}