Title: How do I exclude current post
Last modified: August 30, 2016

---

# How do I exclude current post

 *  [sugardaddy](https://wordpress.org/support/users/sugardaddy/)
 * (@sugardaddy)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/how-do-i-exclude-current-post/)
 * Hi !
    I’m trying to create some queries to display the last posts except the 
   one currently read. If I wrote the query, I use the post__not_in filter and pass
   the parameter to $post->ID I tried this but it doesn’t work. And I want to display
   this query in a widget, not a shortcode (so I can’t use a token I guess).
 * So, is there a way to achieve that ?
 * Thanks a lot for your help !
 * [https://wordpress.org/plugins/query-wrangler/](https://wordpress.org/plugins/query-wrangler/)

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

 *  Thread Starter [sugardaddy](https://wordpress.org/support/users/sugardaddy/)
 * (@sugardaddy)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/how-do-i-exclude-current-post/#post-6871581)
 * After a few investigations, it appears that the generated arg is:
 *     ```
       'post__not_in' =>
         array (
           0 => '$post->ID',
         )
       ```
   
 * instead of what I expected:
 *     ```
       'post__not_in' =>
         array ($post->ID)
       ```
   
 *  Plugin Author [Jonathan Daggerhart](https://wordpress.org/support/users/daggerhart/)
 * (@daggerhart)
 * [10 years, 5 months ago](https://wordpress.org/support/topic/how-do-i-exclude-current-post/#post-6871868)
 * Hi sugardaddy,
 * I understand your problem and will look to provide you with a solution this weekend.
 * Thanks,
    Jonathan
 *  Plugin Author [Jonathan Daggerhart](https://wordpress.org/support/users/daggerhart/)
 * (@daggerhart)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/how-do-i-exclude-current-post/#post-6871876)
 * Hi sugardaddy,
 * I’ve setup the Post IDs filter to allow for contextual tokens. After updating
   to the newest version (1.5.39), edit your filter and replace $post->ID with {{
   post:ID}}
 * Let me know if you run into any issues.
 * Thanks,
    Jonathan

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

The topic ‘How do I exclude current post’ is closed to new replies.

 * ![](https://ps.w.org/query-wrangler/assets/icon-256x256.jpg?rev=3279076)
 * [Query Wrangler](https://wordpress.org/plugins/query-wrangler/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/query-wrangler/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/query-wrangler/)
 * [Active Topics](https://wordpress.org/support/plugin/query-wrangler/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/query-wrangler/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/query-wrangler/reviews/)

## Tags

 * [exclude current](https://wordpress.org/support/topic-tag/exclude-current/)
 * [post__not_in](https://wordpress.org/support/topic-tag/post__not_in/)

 * 3 replies
 * 2 participants
 * Last reply from: [Jonathan Daggerhart](https://wordpress.org/support/users/daggerhart/)
 * Last activity: [10 years, 4 months ago](https://wordpress.org/support/topic/how-do-i-exclude-current-post/#post-6871876)
 * Status: not resolved