WordPress.org

Ready to get started?Download WordPress

Forums

WP_Query not allowing future posts (1 post)

  1. David
    Member
    Posted 1 year ago #

    I have a scheduled post, of custom post type "events". From it's single page (which I've allowed to be viewable via a hack), I call a function in a plugin I built.

    Within the plugin, I run create a new query, like this:

    $query = new WP_Query('p=46913&posts_per_page=1&post_type=any&post_status=future,publish');
    while ( $query->have_posts() ) : $query->the_post();

    Post ID 46913 is the same scheduled post I came to this plugin from. The have_posts function returns false because post_count = 0, because it's a future post. How do I override / reset / run this loop correctly? I've tried a lot of things and the loop just won't go even though all the other correct info is sitting in $wp_query.

Topic Closed

This topic has been closed to new replies.

About this Topic