WordPress.org

Codex

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

Function Reference/is preview

Description

This Conditional Tag checks if the currently displayed post, page or post type is a preview. This is a boolean function that will return the value of the preview query value, which is either true or false for a front-end page.

Usage

<?php is_preview(); ?>

Parameters

This tag does not accept any parameters.

Return Values

(boolean) 
True on success, false on failure.

Examples

if ( ! is_preview() ) {
    // Include analytics code
}

Notes

Change Log

Since: 2.0.0

Source File

is_preview() is located in wp-includes/query.php.

Related

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