Example 1 — Show a preview notice
Remind the author that this page is not live yet.
<?php if ( is_preview() ) {
echo '<p class="notice">Preview mode. This post is not public.</p>';
} ?> How It Works
is_preview()is true only in preview mode.- The notice is printed above the post.
- Visitors never see it.

