Title: Exclude current post
Last modified: August 31, 2016

---

# Exclude current post

 *  Resolved [legius](https://wordpress.org/support/users/legius/)
 * (@legius)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/exclude-current-post-6/)
 * Hello,
    I am looking for a way to **exclude the current post from the query results**.
 * I know that, via the WP_Query, I must exclude the {{post:ID}}.
    [Here](https://wordpress.org/support/topic/current-post-id-filter?replies=5)
   I found how to get values from the current post: `[query slug="my-query" args
   ="p={{post:ID}}"]`
 * but the contrary doesn’t seem working. I tried for example this:
    `[query slug
   ="my-query" args="p!={{post:ID}}"]` but without success.
 * I try to achieve the following query:
    `[qw_query slug="my-query" args="p!={{
   post:ID}}&s=my-keyword&post-type=post"]` (= “show all posts containing the my-
   keyword excepted the current post”)
 * Can you please help?
 * [https://wordpress.org/plugins/query-wrangler/](https://wordpress.org/plugins/query-wrangler/)

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

 *  Plugin Author [Jonathan Daggerhart](https://wordpress.org/support/users/daggerhart/)
 * (@daggerhart)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/exclude-current-post-6/#post-7175486)
 * Hi legius,
 * If you do not already have a Post IDs filter on your query, you can achieve this
   by adding one.
 * 1. Add Filter – Post IDs
    2. Provide the post IDs: `{{post:ID}}` 3. Change “How
   to treat these post IDs” to show “Not these posts”
 * Here is a screenshot of the filter.
    [http://www.daggerhart.com/wp-content/uploads/qw-exclude-current-post.png](http://www.daggerhart.com/wp-content/uploads/qw-exclude-current-post.png)
 * This will automatically exclude the current post anywhere the query is show, 
   so you won’t have to use the shortcode arguments.
 * Note: The reason i qualified this with “If you do not have a Post IDs filter 
   on your query” is because a query can’t have both a “post__in” and “post__not_in”
   filters.
 * If you already have a Post IDs filter that is including specific posts, then 
   this approach won’t work. Let me know and I’ll come up with something else.
 * Thanks,
    Jonathan
 *  Thread Starter [legius](https://wordpress.org/support/users/legius/)
 * (@legius)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/exclude-current-post-6/#post-7175502)
 * Hi Jonathan,
    thanks for your answer, it works exactly as I needed. I tried to
   do it via the shortcode argument without thinking that the {{post:ID}} can be
   used also in the Query settings filter.
 * Perfect!
    And thanks for such a quick help!

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

The topic ‘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/)

 * 2 replies
 * 2 participants
 * Last reply from: [legius](https://wordpress.org/support/users/legius/)
 * Last activity: [10 years, 1 month ago](https://wordpress.org/support/topic/exclude-current-post-6/#post-7175502)
 * Status: resolved