Answers.Body: <p>To exclude the current post use the current post's id with a <em>"not"</em> clause in the <code>id</code> query param.</p>
  
  <pre><code>{% for relatedPost in craft.entries.relatedTo(entry.newsCategory).id('not ' ~ entry.id).limit(5).all() %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-08-10T20:37:46.133Z
Answers.Text: Beauty!  Thank you!  If you don’t mind another question, where do you recommend people go to learn this sort of thing?
Answers.UserDisplayName: Eric A. Meyer
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-08-10T20:39:19.243Z
Answers.Text: Craft Stack Exchange is the usual place or asking on the Craft Slack channel. https://craftcms.com/community  The Craft community is very helpful.
Answers.UserDisplayName: a-am
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-08-10T20:32:57.087Z
Answers.LastActivityDate: 2018-08-16T20:59:02.283Z
Answers.LastEditDate: 2018-08-16T20:59:02.283Z
Answers.UserDisplayName: a-am
Body: <p>In Craft 3, I’m trying to get the five most recent other posts sharing a category with the current post.  I got this far:</p>
  
  <pre><code>{% for relatedPost in craft.entries.relatedTo(entry.newsCategory).limit(5) %}
  </code></pre>
  
  <p>That gets five posts sharing the current post’s category, <em>including</em> the current post if it happens to be recently posted.  How do I exclude the current post from the returned results, without just dropping it from the five so I’m only left with four?</p>
  
Tags: <craft3><categories><relatedto>
Title: Get related posts excluding current post in Craft 3
ThreadText: # Get related posts excluding current post in Craft 3
  
  (Asked by: username_0 on 2018-08-10)
  
  In Craft 3, I’m trying to get the five most recent other posts sharing a category with the current post. I got this far:
  
  ```
  {% for relatedPost in craft.entries.relatedTo(entry.newsCategory).limit(5) %}
  
  ```
  
  That gets five posts sharing the current post’s category, *including* the current post if it happens to be recently posted. How do I exclude the current post from the returned results, without just dropping it from the five so I’m only left with four?
  
  **Tags:** craft3, categories, relatedto
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2018-08-10. Score: 8 | Accepted answer
  
  To exclude the current post use the current post's id with a *"not"* clause in the `id` query param.
  
  ```
  {% for relatedPost in craft.entries.relatedTo(entry.newsCategory).id('not ' ~ entry.id).limit(5).all() %}
  
  ```
  
  > **Comments:**
  > **username_0**: Beauty!  Thank you!  If you don’t mind another question, where do you recommend people go to learn this sort of thing?  
  > **username_1**: Craft Stack Exchange is the usual place or asking on the Craft Slack channel. https://craftcms.com/community  The Craft community is very helpful.  
  
  ---
  
  