Title: Query Posts By Date Range
Last modified: August 19, 2016

---

# Query Posts By Date Range

 *  [pgatroy](https://wordpress.org/support/users/pgatroy/)
 * (@pgatroy)
 * [17 years, 4 months ago](https://wordpress.org/support/topic/query-posts-by-date-range/)
 * I would like to create a template page which pulls posts from a certain category
   according to a specific date range.
 * Can someone please provide me with the code to do this? I know how to pull certain
   categories but don’t know how to filter by date range.
 * Thank you.

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

 *  [buddha-trance](https://wordpress.org/support/users/buddha-trance/)
 * (@buddha-trance)
 * [17 years, 4 months ago](https://wordpress.org/support/topic/query-posts-by-date-range/#post-920250)
 * Read this codex reference on [query_posts](http://codex.wordpress.org/Template_Tags/query_posts).
 * Example 2 is probably what you are looking for, then scroll down to time parameters.
 *  [greggo](https://wordpress.org/support/users/greggo/)
 * (@greggo)
 * [17 years, 3 months ago](https://wordpress.org/support/topic/query-posts-by-date-range/#post-920426)
 * Example 2 doesn’t address a range, but rather just a specific date, month or 
   year. For instance, I am using future-is-now and want to be able to retrieve 
   the next 3 posts dated later than today. How would you do that?
 *  [buddha-trance](https://wordpress.org/support/users/buddha-trance/)
 * (@buddha-trance)
 * [17 years, 2 months ago](https://wordpress.org/support/topic/query-posts-by-date-range/#post-920428)
 * Try with these threads about displaying future posts [http://wordpress.org/tags/futureposts](http://wordpress.org/tags/futureposts)
 * There, I found this link, which may have your solution. Maybe you can adapt the
   code to your needs?
    [http://www.keithmillington.co.uk/wordpress/?p=22](http://www.keithmillington.co.uk/wordpress/?p=22),
   then add `&showposts=3` to limit the number of posts.
 * Hope this helps.
 *  [edaigh](https://wordpress.org/support/users/edaigh/)
 * (@edaigh)
 * [16 years, 11 months ago](https://wordpress.org/support/topic/query-posts-by-date-range/#post-920461)
 * I need this as well. The answers posted so far are close, but don’t actually 
   address the “range” issue. All I need is a list of all the posts in all categories
   posted in the last seven days. can someone please help?
    thanks, e.
 *  [MichaelH](https://wordpress.org/support/users/michaelh/)
 * (@michaelh)
 * [16 years, 11 months ago](https://wordpress.org/support/topic/query-posts-by-date-range/#post-920462)
 * This should help:
    [http://wordpress.org/support/topic/267931?replies=2#post-1066144](http://wordpress.org/support/topic/267931?replies=2#post-1066144)

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

The topic ‘Query Posts By Date Range’ is closed to new replies.

## Tags

 * [date range](https://wordpress.org/support/topic-tag/date-range/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 5 replies
 * 5 participants
 * Last reply from: [MichaelH](https://wordpress.org/support/users/michaelh/)
 * Last activity: [16 years, 11 months ago](https://wordpress.org/support/topic/query-posts-by-date-range/#post-920462)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
