Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I need to check if there is an post to be published in future. I want to use WP functions, no directly access to database via mysql_query.

Has anyone some sample of code?

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

You can use get_post_status() within a query to get future posts.

<?php
$args = array( 'post_status' => 'future' );
$my_query = new WP_Query( $args );
while ($my_query->have_posts()) : $my_query->the_post(); ?>
<!-- Do stuff... -->
<?php endwhile; ?>
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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