<pre><code>{% set entries = craft.entries({
  section:        'blog',
  order:          'postDate',
  limit:          5,
  id:             'not ' ~ entry.id
}) %}
</code></pre>

<p>or</p>

<pre><code>{% set entries = craft.entries({
  section:        'blog',
  order:          'postDate',
  limit:          5,
}).id('not ' ~ entry.id) %}
</code></pre>

CC BY-SA 3.0
2014-07-19T18:50:23.730Z
Thanks for the reply. I tried that but then I get the error: "Variable "entry" does not exist".
Niall Thompson
CC BY-SA 3.0
2014-07-19T18:52:21.963Z
What is the *current entry* that you are trying to exclude?
Marion Newlevant
CC BY-SA 3.0
2014-07-19T18:54:12.767Z
Ah, I understand. I'm editing the wrong template :(
Niall Thompson
CC BY-SA 3.0
2014-07-19T18:47:38.737Z
2014-07-19T18:47:38.737Z
Marion Newlevant
<p>How can I exclude the current entry when I've structured my syntax like this?</p>

<pre><code>{% set entries = craft.entries({
  section:        'blog',
  order:          'postDate',
  limit:          5,
}) %}
</code></pre>

<entries>
Exclude Current Entry
# Exclude Current Entry

(Asked by: username_0 on 2014-07-19)

How can I exclude the current entry when I've structured my syntax like this?
{% set entries = craft.entries({
  section:        'blog',
  order:          'postDate',
  limit:          5,
}) %}

**Tags:** entries


---

## 1 answers

### Answer by username_1 on 2014-07-19. Score: 39 | Accepted answer

{% set entries = craft.entries({
  section:        'blog',
  order:          'postDate',
  limit:          5,
  id:             'not ' ~ entry.id
}) %}

or
{% set entries = craft.entries({
  section:        'blog',
  order:          'postDate',
  limit:          5,
}).id('not ' ~ entry.id) %}

> **Comments:**
> **username_0**: Thanks for the reply. I tried that but then I get the error: "Variable "entry" does not exist".  
> **username_1**: What is the *current entry* that you are trying to exclude?  
> **username_0**: Ah, I understand. I'm editing the wrong template :(  

---

