WordPress.org

Codex

Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Function Reference/is customize preview

Description

This Conditional Tag checks if the site is embedded in the Customizer preview iframe. This is a boolean function that will return true if the site is previewed in the Customizer and false if it's not.

Usage

<?php is_customize_preview(); ?>

Parameters

This tag does not accept any parameters.

Return Values

(boolean) 
True if the site is being previewed in the Customizer, false otherwise.

Examples

if ( is_customize_preview() ) {
    // Output a demo content
}

Notes

Change Log

Since: 4.0.0

Source File

is_customize_preview() is located in wp-includes/theme.php.

Related

See also index of Function Reference and index of Template Tags.