[wp-trac] [WordPress Trac] #42089: Function to detect if current page is a preview of a draft

WordPress Trac noreply at wordpress.org
Wed Oct 4 17:56:23 UTC 2017


#42089: Function to detect if current page is a preview of a draft
---------------------------+-----------------------------
 Reporter:  paulschreiber  |      Owner:
     Type:  enhancement    |     Status:  new
 Priority:  normal         |  Milestone:  Awaiting Review
Component:  General        |    Version:  4.8.2
 Severity:  normal         |   Keywords:
  Focuses:                 |
---------------------------+-----------------------------
 It would be very helpful if there was a function to detect if the page
 being viewed is a scheduled post. Call this is_draft_preview().
 Currently, you can achieve this check with code like this:
 {{{#!php
 <?php
 function is_draft_preview() {
     global $post;
     $is_draft = 'draft' === $post->post_status;
     return ( is_preview() && $is_draft );
 }
 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/42089>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list