wc_set_template_cache( string $cache_key, string $template )

Add a template to the template cache.


Description Description


Parameters Parameters

$cache_key

(Required) Object cache key.

$template

(Required) Located template.


Top ↑

Source Source

File: includes/wc-core-functions.php

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' );
}

Top ↑

Changelog Changelog

Changelog
Version Description
4.3.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.