Title: Prevent same post in multiple loops
Last modified: August 20, 2016

---

# Prevent same post in multiple loops

 *  Resolved [joaoramos](https://wordpress.org/support/users/joaoramos/)
 * (@joaoramos)
 * [14 years, 12 months ago](https://wordpress.org/support/topic/similar-posts-without-plugin/)
 * I’m using [this](http://pastie.org/private/wrcmxa0rnqdbxkbwlvveg) on my _single.
   php_ to retrieve both the similar posts (using the same tags) and the popular
   posts (using comment count) as well. There is a problem, though. How to prevent
   similar posts to show up as popular posts too?

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

 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [14 years, 12 months ago](https://wordpress.org/support/topic/similar-posts-without-plugin/#post-2113517)
 * possibly:
    [http://pastebin.com/HTRhygAG](http://pastebin.com/HTRhygAG)
 * re 1.
    turn all tag ids into one array;
 * re 2.
    use the ‘post__not_in’ in the second loop, with an array of collected 
   post ids.
 *  Thread Starter [joaoramos](https://wordpress.org/support/users/joaoramos/)
 * (@joaoramos)
 * [14 years, 12 months ago](https://wordpress.org/support/topic/similar-posts-without-plugin/#post-2113552)
 * Ah, dumb me — I completely forgot I could do that using ‘post__not_in’. Thank
   you!

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

The topic ‘Prevent same post in multiple loops’ is closed to new replies.

## Tags

 * [comparing](https://wordpress.org/support/topic-tag/comparing/)
 * [popular](https://wordpress.org/support/topic-tag/popular/)
 * [post](https://wordpress.org/support/topic-tag/post/)
 * [similar](https://wordpress.org/support/topic-tag/similar/)
 * [single](https://wordpress.org/support/topic-tag/single/)
 * [tag](https://wordpress.org/support/topic-tag/tag/)
 * [tags](https://wordpress.org/support/topic-tag/tags/)

 * 2 replies
 * 2 participants
 * Last reply from: [joaoramos](https://wordpress.org/support/users/joaoramos/)
 * Last activity: [14 years, 12 months ago](https://wordpress.org/support/topic/similar-posts-without-plugin/#post-2113552)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
