WP_Widget::is_preview

Advertisement

Summery Summery

Determines whether the current request is inside the Customizer preview.

Syntax Syntax

WP_Widget::is_preview()

Description Description

If true — the current request is inside the Customizer preview, then the object cache gets suspended and widgets should check this to decide whether they should store anything persistently to the object cache, to transients, or anywhere else.

Return Return

(bool) True if within the Customizer preview, false if not.

Source Source

File: wp-includes/class-wp-widget.php

	public function is_preview() {
		global $wp_customize;
		return ( isset( $wp_customize ) && $wp_customize->is_preview() );
	}

Advertisement

Changelog Changelog

Changelog
Version Description
3.9.0 Introduced.

Advertisement

Leave a Reply