wc_set_template_cache()
Add a template to the template cache.
Хуков нет.
Возвращает
null. Ничего (null).
Использование
wc_set_template_cache( $cache_key, $template );
- $cache_key(строка) (обязательный)
- Object cache key.
- $template(строка) (обязательный)
- Located template.
Список изменений
| С версии 4.3.0 | Введена. |
Код wc_set_template_cache() wc set template cache WC 10.7.0
function wc_set_template_cache( $cache_key, $template ) {
wp_cache_set( $cache_key, $template, 'woocommerce' );
$cached_templates = wp_cache_get( 'cached_templates', 'woocommerce' );
if ( is_array( $cached_templates ) ) {
$cached_templates[] = $cache_key;
} else {
$cached_templates = array( $cache_key );
}
wp_cache_set( 'cached_templates', $cached_templates, 'woocommerce' );
}