Title: posts_where filter and offset
Last modified: August 21, 2016

---

# posts_where filter and offset

 *  [phe.le](https://wordpress.org/support/users/phele/)
 * (@phele)
 * [13 years ago](https://wordpress.org/support/topic/posts_where-filter-and-offset/)
 * Hi all,
 * I’m trying to use posts_where filter to get posts from a specific time period.
   It’s working fine, but I can’t get it to work with offset (after x number of 
   posts). Can anyone help me?
 *     ```
       <?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 filter: [http://codex.wordpress.org/Plugin_API/Filter_Reference/posts_where](http://codex.wordpress.org/Plugin_API/Filter_Reference/posts_where)
 * Source: [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)
 * _[please continue with your existing topic [http://wordpress.org/support/topic/wordpress-posts\_where-and-offset?replies=1](http://wordpress.org/support/topic/wordpress-posts_where-and-offset?replies=1)]_

The topic ‘posts_where filter and offset’ is closed to new replies.

## Tags

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

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 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/posts_where-filter-and-offset/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
