Make WordPress Core

Opened 8 years ago

Closed 2 months ago

#42088 closed enhancement (maybelater)

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

Reported by: paulschreiber's profile paulschreiber Owned by:
Milestone: Priority: normal
Severity: normal Version:
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 (3)

#1 @SergeyBiryukov
8 years ago

  • Component changed from General to Posts, Post Types

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


2 months ago

#3 @SirLouen
2 months ago

  • Milestone Awaiting Review deleted
  • Resolution set to maybelater
  • Status changed from new to closed
  • Version 4.8.2 deleted

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.