WC_Widget::get_cached_widget( array $args )
Get cached widget.
Description Description
Parameters Parameters
- $args
-
(Required) Arguments.
Return Return
(bool) true if the widget is cached otherwise false
Source Source
File: includes/abstracts/abstract-wc-widget.php
public function get_cached_widget( $args ) { // Don't get cache if widget_id doesn't exists. if ( empty( $args['widget_id'] ) ) { return false; } $cache = wp_cache_get( $this->get_widget_id_for_cache( $this->widget_id ), 'widget' ); if ( ! is_array( $cache ) ) { $cache = array(); } if ( isset( $cache[ $this->get_widget_id_for_cache( $args['widget_id'] ) ] ) ) { echo $cache[ $this->get_widget_id_for_cache( $args['widget_id'] ) ]; // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped return true; } return false; }