• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
Yoast SEO a2z

Yoast SEO a2z

WordPress SEO a2z

  • Home
  • Plugins
  • Blocks
  • Shortcodes
  • APIs
  • Classes
  • Files
  • Hooks
  • Sitemap
  • Blog
Home / APIs / WPSEO_Sitemaps::get_sitemap_from_cache() – Try to get the sitemap from cache.

You appear to be a bot. Output may be restricted

Description

Try to get the sitemap from cache.

Usage

$bool = WPSEO_Sitemaps::get_sitemap_from_cache( $type, $page_number );

Parameters

$type
( string ) required – Sitemap type.
$page_number
( int ) required – The page number to retrieve.

Returns

bool If the sitemap has been retrieved from cache.

Source

File name: wordpress-seo/inc/sitemaps/class-sitemaps.php
Lines:

1 to 30 of 30
  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;
  }
 

 View on GitHub View on Trac

Published: 27th November 2019 | Last updated: 7th February 2020

Primary Sidebar

Information

Function name: WPSEO_Sitemaps::get_sitemap_from_cache
Class ref: WPSEO_Sitemaps
Plugin ref: Yoast SEO
Version: 15.4
Sourcefile: inc/sitemaps/class-sitemaps.php
File ref: inc/sitemaps/class-sitemaps.php
Deprecated?: No
API Letters: F,G,S,W

Footer

Yoast SEO a2z
Yoast SEO a2z
WordPress SEO a2z
WordPress 5.6
WordPress a2z
WordPress core a2z
Genesis Theme Framework a2z
Jetpack a2z
WordPress develop tests
Easy Digital Downloads a2z
WooCommerce a2z
Yoast SEO a2z
WordPress Blocks

Site:  wordpress-seo.wp-a2z.org
© Copyright Yoast SEO a2z 2017-2021. All rights reserved.


Website designed and developed by Herb Miller
Proudly powered by WordPress and oik plugins

  • Home
  • Blog
  • Sitemap
  • Sites