WordPress at Your Fingertips
function is not described

WC_Widget::get_widget_id_for_cache() protected WC 3.4.0

Get widget id plus scheme/protocol to prevent serving mixed content from (persistently) cached widgets.

{} It's a method of the class: WC_Widget{}

Hooks from the method
Return

String. Widget id including scheme/protocol.

Usage

// protected - for code of main (parent) or child class
$result = $this->get_widget_id_for_cache( $widget_id, $scheme );
$widget_id(string) (required)
Id of the cached widget.
$scheme(string)
Scheme for the widget id.

Changelog

Since 3.4.0 Introduced.

Code of WC_Widget::get_widget_id_for_cache() WC 5.5.2

<?php
protected function get_widget_id_for_cache( $widget_id, $scheme = '' ) {
	if ( $scheme ) {
		$widget_id_for_cache = $widget_id . '-' . $scheme;
	} else {
		$widget_id_for_cache = $widget_id . '-' . ( is_ssl() ? 'https' : 'http' );
	}

	return apply_filters( 'woocommerce_cached_widget_id', $widget_id_for_cache );
}