Title: WordPress posts_where and Offset
Last modified: August 21, 2016

---

# WordPress posts_where and Offset

 *  [phe.le](https://wordpress.org/support/users/phele/)
 * (@phele)
 * [13 years ago](https://wordpress.org/support/topic/wordpress-posts_where-and-offset/)
 * Hi,
 * I’m currently using the post_where filter to get posts from specific date period.
   For some reason, it does not work with offset. Have anyone done something like
   this before?
 *     ```
       <?php
       function filter_where($where = '') {
       	//posts in the last 10 days
       	//$where .= " AND post_date > '" . date('Y-m-d', strtotime('-11 days')) . "'";
       	//posts  30 to 60 days old
       	$where .= " AND post_date >= '" . date('Y-m-d', strtotime('-21 days')) . "'" . " AND post_date <= '" . date('Y-m-d', strtotime('-11 days')) . "'";
       	//posts for March 1 to March 15, 2009
       	//$where .= " AND post_date >= '2009-03-01' AND post_date <= '2009-03-15'";
       	return $where;
       }
       add_filter('posts_where', 'filter_where');
       query_posts( 'cat=-3,-19,-88&offset=6&showposts=-1' );
       ?>
       ```
   
 * posts_where: [http://codex.wordpress.org/Plugin_API/Filter_Reference/posts_where](http://codex.wordpress.org/Plugin_API/Filter_Reference/posts_where)
 * [http://wordpress.org/support/topic/show-the-posts-published-before-a-specific-date?replies=2#post-1066144](http://wordpress.org/support/topic/show-the-posts-published-before-a-specific-date?replies=2#post-1066144)

The topic ‘WordPress posts_where and Offset’ is closed to new replies.

## Tags

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

 * 0 replies
 * 1 participant
 * Last reply from: [phe.le](https://wordpress.org/support/users/phele/)
 * Last activity: [13 years ago](https://wordpress.org/support/topic/wordpress-posts_where-and-offset/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
