Title: Excluding current post
Last modified: August 22, 2016

---

# Excluding current post

 *  Resolved [philipt18](https://wordpress.org/support/users/philipt18/)
 * (@philipt18)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/excluding-current-post/)
 * How do you exclude the current post from the results of a loop? I tried the following:
 *     ```
       <table>
       <caption>Other Articles</caption>
       [pass field="id"]
       [loop type="post" category="somecat" exclude="{FIELD}"]
       <tr><td>[field title-link]</td></tr>
       [/loop]
       [/pass]
       </table>
       ```
   
 * but the current post was still included. Thanks for your help.
 * [https://wordpress.org/plugins/custom-content-shortcode/](https://wordpress.org/plugins/custom-content-shortcode/)

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

 *  [haryston](https://wordpress.org/support/users/haryston/)
 * (@haryston)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/excluding-current-post/#post-5316662)
 * +1.
 * I would also appreciate the help!
 *  Plugin Author [Eliot Akira](https://wordpress.org/support/users/miyarakira/)
 * (@miyarakira)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/excluding-current-post/#post-5316684)
 * Good point, I’ll include this as a new parameter in the next update. For the 
   time being, have you tried using exclude=”{ID}”?
 *  [Julie](https://wordpress.org/support/users/habannah/)
 * (@habannah)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/excluding-current-post/#post-5316685)
 * Me too!
 * Using the pass field, the excluded id still appears. But if you just set the 
   excluded id manually (by inputting the number), then it works. However, that 
   doesn’t allow for templating.
 * Also, whether using the pass code or just the regular loop code, this loop view
   breaks my JetPack Shares & Likes, which simply disappear from the page. Any ideas
   why that might be and how to fix it?
 * Thanks!
 *  [Julie](https://wordpress.org/support/users/habannah/)
 * (@habannah)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/excluding-current-post/#post-5316686)
 * Oops! I was writing at the same time as you, Eliot.
 * To use exclude=”{ID}”, do we still need to include the pass code?
 *  Plugin Author [Eliot Akira](https://wordpress.org/support/users/miyarakira/)
 * (@miyarakira)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/excluding-current-post/#post-5316724)
 * Yes, it looks a bit strange but you can do:
 *     ```
       [pass]
         [loop type="post" exclude="{ID}"]
           [field title]
         [/loop]
       [/pass]
       ```
   
 * ..and it should exclude the current post. I’ll add a simpler way to do this with
   a parameter for loop.
 * —
 * As for JetPack Shares & Likes, I’m not sure why the loop would affect it. I’ve
   made sure that the loop cleans up after itself (reset query) but it’s possible
   that there is still something which Shares & Likes expects differently. I’ll 
   try to set up a test case to recreate the issue – please let me know if you find
   out more.
 *  [Julie](https://wordpress.org/support/users/habannah/)
 * (@habannah)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/excluding-current-post/#post-5316744)
 * Thanks Eliot!
 * The Shares & Likes seem to disappear when I try to use the pass shortcode within
   a custom field. The situation above was the only time it ever happened with the
   loop shortcode, which I was testing on a post. I tried it with just the loop 
   and then with the pass shortcode and the result was the same.
 * However, I wonder if I’m using the pass shortcode correctly. Instead of your 
   example, I would have done this:
 *     ```
       [pass field="id"]
       [loop type="post" exclude="{FIELD}"]
       [field title]
       [/loop]
       [/pass]
       ```
   
 * Might that be my problem? Or should that work?

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

The topic ‘Excluding current post’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/custom-content-shortcode_766976.svg)
 * [Custom Content Shortcode](https://wordpress.org/plugins/custom-content-shortcode/)
 * [Support Threads](https://wordpress.org/support/plugin/custom-content-shortcode/)
 * [Active Topics](https://wordpress.org/support/plugin/custom-content-shortcode/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/custom-content-shortcode/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/custom-content-shortcode/reviews/)

 * 6 replies
 * 4 participants
 * Last reply from: [Julie](https://wordpress.org/support/users/habannah/)
 * Last activity: [11 years, 8 months ago](https://wordpress.org/support/topic/excluding-current-post/#post-5316744)
 * Status: resolved