WordPress.org

Support

Support » How-To and Troubleshooting » WordPress showing unpublished posts

WordPress showing unpublished posts

  • Basically I created a custom page template using this wp query code

    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    <?php get_template_part( 'content', 'page' ); ?>
    	<?php endwhile; else: endif; ?>
    
    	<?php global $wp_query;
    
    	$wp_query = new WP_Query('category_name='.get_the_title().'&post_status=publish,future'.'&showposts=8'.'&paged='.$paged);?>
    	<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    
    /***************I cut out the unrelated codes****************/
    
    	<?php endwhile; else: endif; ?>

    The problem is when I schedule a post for a future date, it displays it in the page using this custom page template.

    Does anyone know the conditional tag for scheduled posts so I could exclude it?

  • The topic ‘WordPress showing unpublished posts’ is closed to new replies.
Skip to toolbar