My question here is to display all the single detail page of future scheduled posts. It is returning 404 page. How can this be done in wordpress?

What I have used so far is

$args =  array(
            'posts_per_page'   => 10, 
            'category__in'     => $category->term_id,
            'orderby'          => 'post_date',
            'meta_key'         => 'starttime',
            'order'            => 'ASC', 
            'post_type'        => 'post', 
            'post_status'      => array('publish','future'),
        $loop1 = new WP_Query( $args );

From this code I get published, and scheduled posts. The permalink of the published post is working fine. But it is not working for scheduled posts, and redirecting to 404 page error.

  • I have updated my question with code, please check May 31, 2014 at 5:06

3 Answers 3


A much cleaner solution is to just set the post status via pre_get_posts. By default, the main query only shows published posts to logged out users and published and private posts to logged in users.

We can add future posts to main query with pre_get_posts

add_action( 'pre_get_posts', function ( $q )
    if (    !is_admin()
         && $q->is_main_query()
         && $q->is_single()
    ) {
        $q->set( 'post_status', ['publish', 'future'] );
  • Thanks for the answer, but as you can see in my query, I am getting both future and published posts. But the issue I am facing is that I am not able to access post details page, for future posts, i hope you understand May 31, 2014 at 5:56

After some research this worked for me:

add_filter('the_posts', 'show_future_posts');

function show_future_posts($posts)
   global $wp_query, $wpdb;

   if(is_single() && $wp_query->post_count == 0)
      $posts = $wpdb->get_results($wp_query->request);

   return $posts;

Hopefully it will work for others who are in same problem.


Try this code as well for displaying list of scheduled posts:

<?php $my_query = new WP_Query('post_status=future&order=DESC&showposts=5');
if ($my_query->have_posts()) {
    while ($my_query->have_posts()) : $my_query->the_post(); $do_not_duplicate = $post->ID; ?>

        <li><?php the_title(); ?></li>

    <?php endwhile; } ?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.