On this page
WP_Widget::is_preview(): bool
Determines whether the current request is inside the Customizer preview.
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
bool True if within the Customizer preview, false if not.
Source
File: wp-includes/class-wp-widget.php. View all references
public function is_preview() {
global $wp_customize;
return ( isset( $wp_customize ) && $wp_customize->is_preview() );
}
Related
Used By
| Used By | Description |
|---|---|
| WP_Widget::display_callback() wp-includes/class-wp-widget.php | Generates the actual widget content (Do NOT override). |
| WP_Widget::update_callback() wp-includes/class-wp-widget.php | Handles changed settings (Do NOT override). |
Changelog
| Version | Description |
|---|---|
| 3.9.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_widget/is_preview