Title: changing posts_where string for custom post type
Last modified: August 20, 2016

---

# changing posts_where string for custom post type

 *  [christian_gnoth](https://wordpress.org/support/users/christian_gnoth/)
 * (@christian_gnoth)
 * [14 years, 11 months ago](https://wordpress.org/support/topic/changing-posts_where-string-for-custom-post-type-1/)
 * hello,
    I am using a custom post type “ticket” and I am showing 10 on a page.
   At the bottom of the page I have the
 * next_posts_link(‘Next Tickets »’);
 * call for the next tickets page. Unfortunately it returns the same tickets.
 * I tried to use $query_strings and $wp_query, but it too returns the same entries.
 * if I use the filter hook posts_where
 * add_filter( ‘posts_where’, ‘stm_ticket_get_previous_next_post_where’);
 * I get the following date from the where clause:
 * AND (wp_posts.ID = ‘879’)
    AND wp_posts.post_type = ‘page'”
 * string(97)
    “ WHERE p.post_date < ‘2011-06-06 14:59:36’ AND p.post_type = ‘page’
   AND p.post_status = ‘publish’ ”
 * string(97) “
    WHERE p.post_date > ‘2011-06-06 14:59:36’ AND p.post_type = ‘page’
   AND p.post_status = ‘publish’ ”
 * How I can change it so that it returns the custom posts type ticket and to the
   next entries?

The topic ‘changing posts_where string for custom post type’ is closed to new replies.

## Tags

 * [custom post type](https://wordpress.org/support/topic-tag/custom-post-type/)
 * [wp_query](https://wordpress.org/support/topic-tag/wp_query/)

 * In: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
 * 0 replies
 * 1 participant
 * Last reply from: [christian_gnoth](https://wordpress.org/support/users/christian_gnoth/)
 * Last activity: [14 years, 11 months ago](https://wordpress.org/support/topic/changing-posts_where-string-for-custom-post-type-1/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
