0

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?

1 Answer 1

0

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; ?>

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.