WPSEO_Sitemaps_Cache::clear()
Delete cache transients for given sitemaps types or all by default.
Метод класса: WPSEO_Sitemaps_Cache{}
Хуков нет.
Возвращает
null
. Ничего (null).
Использование
$result = WPSEO_Sitemaps_Cache::clear( $types );
- $types(массив)
- Set of sitemap types to delete cache transients for.
По умолчанию: []
Список изменений
С версии 1.8.0 | Введена. |
С версии 3.2 | Moved from WPSEO_Utils to this class. |
Код WPSEO_Sitemaps_Cache::clear() WPSEO Sitemaps Cache::clear Yoast 24.9
public static function clear( $types = [] ) { if ( ! self::$is_enabled ) { return; } // No types provided, clear all. if ( empty( $types ) ) { self::$clear_all = true; return; } // Always invalidate the index sitemap as well. if ( ! in_array( WPSEO_Sitemaps::SITEMAP_INDEX_TYPE, $types, true ) ) { array_unshift( $types, WPSEO_Sitemaps::SITEMAP_INDEX_TYPE ); } foreach ( $types as $type ) { if ( ! in_array( $type, self::$clear_types, true ) ) { self::$clear_types[] = $type; } } }