Title: Current post ID filter?
Last modified: August 22, 2016

---

# Current post ID filter?

 *  Resolved [corinnepritchard](https://wordpress.org/support/users/corinnepritchard/)
 * (@corinnepritchard)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/current-post-id-filter/)
 * Hi there,
 * Forgive me if I’m missing the obvious, but is there any way to have query wrangler
   work out what page / post id it’s currently on and filter by that?
 * Cheers,
 * Corinne
 * [https://wordpress.org/plugins/query-wrangler/](https://wordpress.org/plugins/query-wrangler/)

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

 *  Plugin Author [Jonathan Daggerhart](https://wordpress.org/support/users/daggerhart/)
 * (@daggerhart)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/current-post-id-filter/#post-5231251)
 * Hi corinnepritchard,
 * Absolutely! That’s fairly simple, but is done within the shortcode instead of
   the query interface.
 * Example:
 * [query slug=”my-query” args=”p={{post:ID}}”]
 * There are a few more examples in the FAQ [http://wordpress.org/plugins/query-wrangler/faq/](http://wordpress.org/plugins/query-wrangler/faq/).
 * Let me know how this works out for you,
    Jonathan
 * Edit: whoops, used wrong token. Should be {{post:ID}}
 *  Thread Starter [corinnepritchard](https://wordpress.org/support/users/corinnepritchard/)
 * (@corinnepritchard)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/current-post-id-filter/#post-5231318)
 * Oh! Thank you for replying so quickly.
 * And just saw your edit – phew! Was worried it wasn’t working.
 * Is there a full list of those arguments somewhere as ‘p=’ etc, isn’t necessarily
   intuitive? (couldn’t see one on the link you gave but may just be being blind).
 * Yours,
 * Corinne
 *  Plugin Author [Jonathan Daggerhart](https://wordpress.org/support/users/daggerhart/)
 * (@daggerhart)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/current-post-id-filter/#post-5231325)
 * Sure, there is a reference (sort of).
 * Those arguments all come from the WP_Query class. [http://codex.wordpress.org/Class_Reference/WP_Query#Parameters](http://codex.wordpress.org/Class_Reference/WP_Query#Parameters)
 * Any parameter that is not an array should work.
 * For example, to limit by author:
 * The ‘author’ parameter accepts string values, so it will work.
    `$query = new
   WP_Query( 'author=2,6,17,38' );`
 * As a QW query —
    `[query slug='test' args='author=2,6,17,38']`
 * The ‘author__in’ parameter requires an array value, so it will not work:
    `$query
   = new WP_Query( array( 'author__in' => array( 2, 6 ) ) );`
 * For your case, I used the “p” parameter from here: [http://codex.wordpress.org/Class_Reference/WP_Query#Post_.26_Page_Parameters](http://codex.wordpress.org/Class_Reference/WP_Query#Post_.26_Page_Parameters)
 * You should be able to use anything that takes a string for it’s value.
 * Hope that helps!
 * Let me know if you have any more questions,
    Jonathan
 *  Plugin Author [Jonathan Daggerhart](https://wordpress.org/support/users/daggerhart/)
 * (@daggerhart)
 * [11 years, 9 months ago](https://wordpress.org/support/topic/current-post-id-filter/#post-5231330)
 * Just to follow up with some more explanation.
 * The `{{post:ID}}` I had you use is a “contextual token”. Meaning it’s value is
   derived from the context in which it is used. They are perfect for dynamically
   altering a query based on where it is displayed.
 * But you can also use explicit values if you don’t need the query to be contextually
   dynamic. For example, in the above “author=1,2,17” example, those values are 
   not contextual, and will alter the query the same way no matter where it is shown.

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

The topic ‘Current post ID filter?’ 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/)

 * 4 replies
 * 2 participants
 * Last reply from: [Jonathan Daggerhart](https://wordpress.org/support/users/daggerhart/)
 * Last activity: [11 years, 9 months ago](https://wordpress.org/support/topic/current-post-id-filter/#post-5231330)
 * Status: resolved