WPSEO_Sitemaps::get_sitemap_from_cache()
Try to get the sitemap from cache.
Метод класса: WPSEO_Sitemaps{}
Хуки из метода
Возвращает
true|false
. If the sitemap has been retrieved from cache.
Использование
// private - только в коде основоного (родительского) класса $result = $this->get_sitemap_from_cache( $type, $page_number );
- $type(строка) (обязательный)
- Sitemap type.
- $page_number(int) (обязательный)
- The page number to retrieve.
Код WPSEO_Sitemaps::get_sitemap_from_cache() WPSEO Sitemaps::get sitemap from cache Yoast 22.4
private function get_sitemap_from_cache( $type, $page_number ) { $this->transient = false; if ( $this->cache->is_enabled() !== true ) { return false; } /** * Fires before the attempt to retrieve XML sitemap from the transient cache. * * @param WPSEO_Sitemaps $sitemaps Sitemaps object. */ do_action( 'wpseo_sitemap_stylesheet_cache_' . $type, $this ); $sitemap_cache_data = $this->cache->get_sitemap_data( $type, $page_number ); // No cache was found, refresh it because cache is enabled. if ( empty( $sitemap_cache_data ) ) { return $this->refresh_sitemap_cache( $type, $page_number ); } // Cache object was found, parse information. $this->transient = true; $this->sitemap = $sitemap_cache_data->get_sitemap(); $this->bad_sitemap = ! $sitemap_cache_data->is_usable(); return true; }