Title: Future posts problem
Last modified: August 19, 2016

---

# Future posts problem

 *  [vickilh2](https://wordpress.org/support/users/vickilh2/)
 * (@vickilh2)
 * [17 years, 9 months ago](https://wordpress.org/support/topic/future-posts-problem/)
 * I’m a newbie, and I’ve been pulling my hair out on this one.
 * I wanted to order my posts ascending on a page, so I couldn’t go with the generic
   query. I also want my posts to “age out”.
 * I got the ordering to work, no problem:
    `$posts = query_posts($query_string.'&
   orderby=post_date&order=asc&posts_per_page=30'); ?>`
 * … But I haven’t been able to get rid of old posts. I tried this various ways:‘&
   post_date>=NOW()’ or using monthnum, etc., but these ONLY appear to accept “=”,
   won’t accept a greater than, >.
 * I can’t use ‘post_status=future’ because I changed the post.php code so that 
   everything would go in with a status of ‘publish’ and would show up on the website.
 * Any help greatly appreciated!! Vicki

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Moderator [Samuel Wood (Otto)](https://wordpress.org/support/users/otto42/)
 * (@otto42)
 * WordPress.org Admin
 * [17 years, 9 months ago](https://wordpress.org/support/topic/future-posts-problem/#post-845938)
 * You can’t do that so easily. The WordPress query code has no ability to select
   posts based on “age”.
 * If you manually want to screw around with the query, you need to use a filter
   on the various posts_* filters.
 * Look here: [http://codex.wordpress.org/Plugin_API/Filter_Reference#Advanced_WordPress_Filters](http://codex.wordpress.org/Plugin_API/Filter_Reference#Advanced_WordPress_Filters)
 * Also see here for how to use them:
    [http://codex.wordpress.org/Plugin_API#Filters](http://codex.wordpress.org/Plugin_API#Filters)
 *  Thread Starter [vickilh2](https://wordpress.org/support/users/vickilh2/)
 * (@vickilh2)
 * [17 years, 9 months ago](https://wordpress.org/support/topic/future-posts-problem/#post-845943)
 * So I can’t use boolean operators like “>” (greater than) in situations like this:
   
   [http://codex.wordpress.org/Template_Tags/query_posts#Example_2](http://codex.wordpress.org/Template_Tags/query_posts#Example_2)…
   where I would want to use “>” instead of “=” for monthnum=$current_month, etc.?
   I can only use “=”?
 * Thanks!! Vicki
 *  Thread Starter [vickilh2](https://wordpress.org/support/users/vickilh2/)
 * (@vickilh2)
 * [17 years, 9 months ago](https://wordpress.org/support/topic/future-posts-problem/#post-846067)
 * Ha!! Got it working! Pretty simple really:
 *     ```
       <?php if (have_posts()) : ?>
   
       <?php $today2 = (date('Y-m-d H:d:s')); ?>
       <?php $today = strtotime($today2); ?>
   
       <?php
       $posts = query_posts($query_string.'&orderby=post_date&order=asc&posts_per_page=30&paged=$page'); ?>
   
                       <?php while (have_posts()) : the_post(); ?>
   
                       <?php $posttime = strtotime($post->post_date); ?>
   
                               <?php if ($posttime >= $today) { ?>
       ```
   
 * Struggled for a while to get just the right syntax, but it just didn’t make sense
   that this wouldn’t work.
 * Yay!! Hope this helps someone. Vicki
 *  Thread Starter [vickilh2](https://wordpress.org/support/users/vickilh2/)
 * (@vickilh2)
 * [17 years, 9 months ago](https://wordpress.org/support/topic/future-posts-problem/#post-846069)
 * P.S.
 * And be sure to close your $posttime if with:
 *     ```
       <?php } ?>
       ```
   
 * .. before you close off the main loop:
 *  [Alejandro Sevilla Fuentes](https://wordpress.org/support/users/alexnull/)
 * (@alexnull)
 * [17 years, 9 months ago](https://wordpress.org/support/topic/future-posts-problem/#post-846227)
 * it will be nice that query_posts accept >, <, !=
    🙂
 * and better if can query 2 different custom fields

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Future posts problem’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 5 replies
 * 3 participants
 * Last reply from: [Alejandro Sevilla Fuentes](https://wordpress.org/support/users/alexnull/)
 * Last activity: [17 years, 9 months ago](https://wordpress.org/support/topic/future-posts-problem/#post-846227)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
