Title: Avoid duplicated posts
Last modified: August 20, 2016

---

# Avoid duplicated posts

 *  [Firkraag85](https://wordpress.org/support/users/firkraag85/)
 * (@firkraag85)
 * [13 years, 7 months ago](https://wordpress.org/support/topic/avoit-duplicated-posts/)
 * Hi,
 * I followed this instructions and I could avoid the duplicate posts, but the matter
   is that I only display 3 posts on the differents colums… You’ll see “Secundaria”
   in blank.
 * How can I put posts_per_page=3 to show the last 3 post, but not duplicated, the
   previous ones, do you understand?
 * I hope you can help me.
 * Link: [http://bit.ly/VAlj66](http://bit.ly/VAlj66)
 * A fragment of my code:
 *     ```
       <ul>
       				<!-- NOVEDADES SECUNDARIA -->
       				<?php query_posts('cat=1,-3,-4,-102,-100,-111&order=DESC&posts_per_page=3'); if ( have_posts() ) : while ( have_posts() ) : the_post();  if (!in_array($post->ID, $ids)) { ?>
       				<li id="gradeNews-<?php the_ID(); ?>">
       					<div class="postImage">
       						<a href="<?php the_permalink(); ?>"><?php echo get_post_image('thumbnail','','default-thumb'); ?></a>
       					</div>
       					<div class="postInfo">
       						<div class="postTitle">
       							<h4><a href="<?php the_permalink(); ?>" title="Link permanente a <?php the_title_attribute(); ?>"><?php short_title('','…',true, '35'); ?></a></h4>
       							<p class="postMeta"><?php the_time('j F, Y'); ?></p>
       						</div>
       					</div>
       				</li>
       				<?php } endwhile; else: ?>
       				<li><em>No hay noticias en Secundaria!</em></li>
       				<?php endif; ?>
       				<?php wp_reset_query();?>
       			</ul>
       ```
   
 * Thanks you!

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

 *  Moderator [keesiemeijer](https://wordpress.org/support/users/keesiemeijer/)
 * (@keesiemeijer)
 * [13 years, 7 months ago](https://wordpress.org/support/topic/avoit-duplicated-posts/#post-3154089)
 * So you want to show the latest 3 posts that are in category id 1 and exclude 
   posts from the former loops ($ids)?
    try:
 *     ```
       <?php
       $args= array(
       'cat' => 1,
       'posts_per_page' => '3',
       'post__not_in' => $ids,
       );
       query_posts($args);
       ?>
       ```
   
 * [http://codex.wordpress.org/Function_Reference/WP_Query#Post_.26_Page_Parameters](http://codex.wordpress.org/Function_Reference/WP_Query#Post_.26_Page_Parameters)
 * Can you paste and submit the full code into a [pastebin.com](http://pastebin.com/)
   and post the link to it here? see the [Forum Rules](http://codex.wordpress.org/Forum_Welcome#Posting_Code)
   for posting code and using the pastebin.
 *  Thread Starter [Firkraag85](https://wordpress.org/support/users/firkraag85/)
 * (@firkraag85)
 * [13 years, 7 months ago](https://wordpress.org/support/topic/avoit-duplicated-posts/#post-3154092)
 * Thanks you so much for your reply, yes, I want that, but apperently with what
   you say is not working for me also (my previous code) [http://pastebin.com/embed_iframe.php?i=96dYDZ0s](http://pastebin.com/embed_iframe.php?i=96dYDZ0s)
 * And the one that includes the modifications in SECUNDARIA: [http://pastebin.com/embed_iframe.php?i=u9iBbgsN](http://pastebin.com/embed_iframe.php?i=u9iBbgsN)
 * Thanks again, and again for your answer.
 *  Thread Starter [Firkraag85](https://wordpress.org/support/users/firkraag85/)
 * (@firkraag85)
 * [13 years, 7 months ago](https://wordpress.org/support/topic/avoit-duplicated-posts/#post-3154095)
 * Please forget my previous posts, now I do it again and now is “working”, but 
   I’m receiving this message: Warning: urldecode() expects parameter 1 to be string,
   array given in /home/firk/mysite/wp-includes/query.php on line 1737 (this also
   happens with ” in ‘posts_per_page’ = ‘3’)
 * You can see my full code here: [http://pastebin.com/embed_js.php?i=FnMKRUve](http://pastebin.com/embed_js.php?i=FnMKRUve)
 * And my “dev” web here: [http://bit.ly/VAlj66](http://bit.ly/VAlj66)
 * Thanks!
 *  Thread Starter [Firkraag85](https://wordpress.org/support/users/firkraag85/)
 * (@firkraag85)
 * [13 years, 7 months ago](https://wordpress.org/support/topic/avoit-duplicated-posts/#post-3154118)
 * I tried many things but I can’t solve it. Can anybody help me please?
 * Thanks.

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

The topic ‘Avoid duplicated posts’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 4 replies
 * 2 participants
 * Last reply from: [Firkraag85](https://wordpress.org/support/users/firkraag85/)
 * Last activity: [13 years, 7 months ago](https://wordpress.org/support/topic/avoit-duplicated-posts/#post-3154118)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
