Make WordPress Core

Opened 9 years ago

Closed 12 months ago

#42088 closed enhancement (maybelater)

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

Reported by: paulschreiber Owned by:
Priority: normal Milestone:
Component: Posts, Post Types Version:
Severity: normal Keywords:
Cc: Focuses:

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 (3)

#1 @SergeyBiryukov
9 years ago

  • Component GeneralPosts, Post Types

This ticket was mentioned in Slack in #core by sirlouen. View the logs.


12 months ago

#3 @SirLouen
12 months ago

  • Milestone Awaiting Review
  • Resolutionmaybelater
  • Status newclosed
  • Version 4.8.2

It seems that after 8 years, this hasn't had much traction
Also, we could be using if ( get_post_status() === ‘future’) since $post can be omitted in the loop.
I am not sure how this function will be much more useful, feels redundant and doesn't provide a lot of value.
I'm closing this as maybelater, in case there is more interest, but I seriously doubt this should be ever implemented.

Note: See TracTickets for help on using tickets.