wc_set_template_cache()
Add a template to the template cache.
No Hooks.
Return
null
. Nothing.
Usage
wc_set_template_cache( $cache_key, $template );
- $cache_key(string) (required)
- Object cache key.
- $template(string) (required)
- Located template.
Changelog
Since 4.3.0 | Introduced. |
wc_set_template_cache() wc set template cache code WC 7.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' ); }