WC_Shortcode_Products::get_transient_name()protectedWC 3.3.0

Generate and return the transient name for this shortcode based on the query args.

Метод класса: WC_Shortcode_Products{}

Возвращает

Строку.

Использование

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->get_transient_name();

Список изменений

С версии 3.3.0 Введена.

Код WC_Shortcode_Products::get_transient_name() WC 8.7.0

protected function get_transient_name() {
	$transient_name = 'wc_product_loop_' . md5( wp_json_encode( $this->query_args ) . $this->type );

	if ( 'rand' === $this->query_args['orderby'] ) {
		// When using rand, we'll cache a number of random queries and pull those to avoid querying rand on each page load.
		$rand_index      = wp_rand( 0, max( 1, absint( apply_filters( 'woocommerce_product_query_max_rand_cache_count', 5 ) ) ) );
		$transient_name .= $rand_index;
	}

	return $transient_name;
}