Show future posts in Wordpress 2.3+

To enable Wordpress to show and publish future posts…BEFORE creating future posts (or if you have already created posts - reedit the timestamp in Admin > Manage > Posts). In the file /wp-includes/post.php look for the section:

if ( 'publish' == $post_status ) {
  $now = gmdate('Y-m-d H:i:59');
  if ( mysql2date('U', $post_date_gmt) > mysql2date('U', $now) )
 $post_status = 'future';
 }

change this to:

if ( 'publish' == $post_status ) {
  $now = gmdate('Y-m-d H:i:59');
  if ( mysql2date('U', $post_date_gmt) > mysql2date('U', $now) )
 //hack to show future posts
 $post_status = 'publish';
 }

That worked for me on Wordpress 2.3.3

Tags: , , ,

7 Responses to “Show future posts in Wordpress 2.3+”

  1. Skippy Says:

    It works, but generally you should not modify core WP files or you’ll run into trouble when it’s time to upgrade.

    Here’s a 1-line solution which you can put in your theme in index.php and archive.php. Add it at the top:

    query_posts($query_string.’&post_status=publish,future’);

  2. Jason Says:

    Skippy’s solution will display the post on the index and archive pages, but it will not allow the post to be viewed directly from the single.php template. That is the problem I’m running into.

  3. using wordpress as a calendar for the future - WebProWorld Says:

    [...] Re: using wordpress as a calendar for the future If you haven’t already come across this: Arkytek Ltd :: Blog

  4. Johan Says:

    Hi!

    Is this a solution to actually show future posts in Wordpress? I want to be able to show future posts and use Wordpress as an event/calender publishing system, found a plugin called “eventcalendar” but it doesn’t seem to work in WP2.5.

    Skippy: Im not that good in php, could you explain exactly where in the code to place your solution?

  5. mores Says:

    thanks skippy, your solution was just what I needed. And I don’t need to view future posts in full in my layout, just a mention.
    Excellent, thank you very much!

  6. Michael Says:

    Excellent work .. thanks for this. cheers

  7. ems Says:

    this does not work for me :(

Leave a Reply


Arkytek // development // hosting // creative // support
Copyright © Arkytek Ltd // Entries (RSS) // Comments (RSS).

Valid XHTML 1.0 Transitional