Title: Duplicated posts from shortcode function
Last modified: August 19, 2016

---

# Duplicated posts from shortcode function

 *  Resolved [ivyowl](https://wordpress.org/support/users/ivyowl/)
 * (@ivyowl)
 * [15 years, 1 month ago](https://wordpress.org/support/topic/duplicated-posts-from-shortcode-function/)
 * Hi all,
 * first post here, hope someone can shed some light.
 * I’ve set up an events listing based on Noel Tocks tutorial [here](http://www.noeltock.com/web-design/wordpress/how-to-custom-post-types-for-events-pt-2/).
 * Basically using custom post types to input the data, then a function so i can
   call it through shortcode.
 * I’ve set it up to just show the posts from specific catagories so i can show 
   them in different places.
 * It all works fine, except its duplicating the posts. I have 4 copies of 1 post,
   5 of another, and then another 4 of the last post!
 * Have had a look into multiple loops but as this is within a function i wasn’t
   sure how to stop them from duplicated. Any help would be much apprecieated.
 * Codes here:
 * _[code moderated as per [forum rules ](http://codex.wordpress.org/Forum_Welcome)-
   please use the [pastebin](http://pastebin.com/)]_
 * Thanks!!

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

 *  [Alwyn Botha](https://wordpress.org/support/users/123milliseconds/)
 * (@123milliseconds)
 * [15 years, 1 month ago](https://wordpress.org/support/topic/duplicated-posts-from-shortcode-function/#post-1967538)
 * Code still not posted again; I suspect you will need the following ‘somewhere’
   in those loops
 * Read in the meantime to better understand when someone here help you
 * [http://codex.wordpress.org/Function_Reference/wp_reset_query](http://codex.wordpress.org/Function_Reference/wp_reset_query)
 *  Thread Starter [ivyowl](https://wordpress.org/support/users/ivyowl/)
 * (@ivyowl)
 * [15 years, 1 month ago](https://wordpress.org/support/topic/duplicated-posts-from-shortcode-function/#post-1967570)
 * Code is here now:
 * [http://pastebin.com/maxfQ9Df](http://pastebin.com/maxfQ9Df)

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

The topic ‘Duplicated posts from shortcode function’ is closed to new replies.

## Tags

 * [custom post type](https://wordpress.org/support/topic-tag/custom-post-type/)
 * [duplicate](https://wordpress.org/support/topic-tag/duplicate/)
 * [shortcode](https://wordpress.org/support/topic-tag/shortcode/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [ivyowl](https://wordpress.org/support/users/ivyowl/)
 * Last activity: [15 years, 1 month ago](https://wordpress.org/support/topic/duplicated-posts-from-shortcode-function/#post-1967570)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
