Title: Avoid duplicate post
Last modified: October 24, 2017

---

# Avoid duplicate post

 *  Resolved [Ziqurrat](https://wordpress.org/support/users/ziqurrat/)
 * (@ziqurrat)
 * [8 years, 7 months ago](https://wordpress.org/support/topic/avoid-duplicate-post/)
 * Hi,
 * I have multiple loop in widget in my homepage: one for posts with category A,
   one for posts with category B.
 * In a third loop I would like to put mixed posts but it duplicates the same content
   of the first two loops. I don’t want to fully exclude categories A and B.
    Is
   there a way to collect the posts IDs from the other loops in the same page and
   exclude them from the query?
 * Thanks

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

 *  Plugin Support [Andrew Misplon](https://wordpress.org/support/users/misplon/)
 * (@misplon)
 * [8 years, 7 months ago](https://wordpress.org/support/topic/avoid-duplicate-post/#post-9616458)
 * Hi [@ziqurrat](https://wordpress.org/support/users/ziqurrat/)
 * Thanks for reaching out.
 * Unfortunately, we can’t think of any ways to accomplish this task from within
   any of our widgets.
 * Sorry, wish we had better news. Manually excluding full categories or posts by
   ID’s is as much as we can offer from within the Post Loop widget or widget with
   a post loop query.
 *  Thread Starter [Ziqurrat](https://wordpress.org/support/users/ziqurrat/)
 * (@ziqurrat)
 * [8 years, 7 months ago](https://wordpress.org/support/topic/avoid-duplicate-post/#post-9619696)
 * Hi Andrew, thank you for the reply.
    This would be a nice feature to add to the
   plugin.
 * In the meantime, I’d like to try a workaround.
    I’ve added to the functions.php
   a global var to store the post ids. I’ve got some custom templates for my loops,
   so I can save the IDS to exclude inside the global variable and then use it to
   filter the query by adding the parameter ‘post__not_in’.
 * It works, somehow. But I know that global vars are not a best practice. Have 
   you got any suggestion on how can I make it better?
 *  Plugin Support [Andrew Misplon](https://wordpress.org/support/users/misplon/)
 * (@misplon)
 * [8 years, 7 months ago](https://wordpress.org/support/topic/avoid-duplicate-post/#post-9620187)
 * Thanks for this idea, it’s a good one for sure. I’ve made a note of it on our
   side. With regards to your workaround, unfortunately, we don’t have any better
   ideas at the moment.

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

The topic ‘Avoid duplicate post’ is closed to new replies.

 * ![](https://ps.w.org/siteorigin-panels/assets/icon.svg?rev=2556869)
 * [Page Builder by SiteOrigin](https://wordpress.org/plugins/siteorigin-panels/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/siteorigin-panels/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/siteorigin-panels/)
 * [Active Topics](https://wordpress.org/support/plugin/siteorigin-panels/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/siteorigin-panels/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/siteorigin-panels/reviews/)

## Tags

 * [duplicate](https://wordpress.org/support/topic-tag/duplicate/)
 * [loops](https://wordpress.org/support/topic-tag/loops/)
 * [template](https://wordpress.org/support/topic-tag/template/)

 * 3 replies
 * 2 participants
 * Last reply from: [Andrew Misplon](https://wordpress.org/support/users/misplon/)
 * Last activity: [8 years, 7 months ago](https://wordpress.org/support/topic/avoid-duplicate-post/#post-9620187)
 * Status: resolved