Make WordPress Core

Opened 7 years ago

Last modified 7 years ago

#42088 new enhancement

Function to detect if current page is a scheduled post (is_scheduled() or is_future())

Reported by: paulschreiber's profile paulschreiber Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.8.2
Component: Posts, Post Types Keywords:
Focuses: Cc:

Description

It would be very helpful if there was a function to detect if the page being viewed is a scheduled post. Call this is_scheduled() or is_future().

Currently, you can achieve this check with code link this:

<?php
function is_scheduled() {
    global $post;
    $is_future = 'future' === $post->post_status;
    return ( is_preview() && $is_future );
}

Change History (1)

#1 @SergeyBiryukov
7 years ago

  • Component changed from General to Posts, Post Types
Note: See TracTickets for help on using tickets.