What you describe is not an issue but normal WordPress behaviour. When you mark a post as a sticky it will be at the top of the list and it will appear in it’s original postition as well, unless the original position is on the first page. A sticky will appear at the top of the posts and in it’s original position but it will not appear twice on the same page.
You might want to do something like this:
<?php
while (have_posts()) : the_post();
if ( !in_array( $post->ID, $do_not_duplicate ) ) { // check IDs
// display posts ...
the_title();
//store id in "do not duplicate
$do_not_duplicate = $post->ID;
}
endwhile;
?>
source with minor edit: http://wpengineer.com/1719/filter-duplicate-posts-in-the-loop/
Related Posts:
- How to limit the number of posts that WP_Query gets?
- Should we trust the post globals?
- Random sort within an already sorted query
- Code to make a post sticky
- WP_Query: Why is sticky post not first item in loop?
- how to get a different html for odd/even posts?
- Query *only* sticky posts
- Highlight a Featured Post?
- How to know if get_posts() failed?
- Using $wpdb to query posts with meta value containing current post_id
- Query posts from current year
- WordPress Number of Posts Not Changing With posts_per_page
- I have over 4000 posts, will querying some of them cause performance issues?
- Duplicate posts
- Include Sticky Post in Page Posts Count?
- Looping through posts per category gives same posts for each category
- How to show posts rank based on custom field value
- Display All Sticky Post Before Regular Post
- How do I create Comma Separated list of attached image ids?
- How to add posts to wp_query result?
- Trying to put an array into ‘post__in’ => array() query not working
- Order post by year DESC and month ASC
- Should ‘setup_postdata()’ be reset with ‘wp_reset_postdata()’?
- How can I display a specific user’s first published post?
- Query All users that has post
- wp_enqueue_media() slows down my WP site
- How can I get all posts data from within a paginated search result?
- Search query – exact post title match
- Sorting posts alphabetical that have single digits
- Query posts from different categories in multisite
- Check if post exists
- posts_per_page doesnt work
- Sorting posts according to view counts not working
- Display page content AFTER a loop of posts
- Only display posts after current date
- Get posts by multiple ID’s (query)
- How to start with post number x?
- Exclude posts with empty post_content in wp_query
- Only display a certain number of posts, dependent on how many posts there are available in a query
- Improving WP_Query for performance when random posts are ordered
- Should $found_posts be returned as string in ‘found_posts’ filter hook?
- Query how many items to show in shortcode
- Get posts by name and taxonomy term
- WP_Query Authors OR Categories
- Get Posts that are in the current month or later
- Ignore posts content in the posts queries for internal linking
- How to search through “post title” and “tags” using WP_Query?
- Need to display a Jan 1st post as the site’s front page on Jan 1st, and Jan 2nd post as front page on Jan 2nd etc
- I have two post types in the same query, how can I use CSS to select only one post type?
- filter posts based on menu_order
- Bulk Post update_post_meta
- Count posts for pagination
- Show 5 posts and than 3 posts offset with pagination
- AJAX load more posts not using correct category and repeating the same few posts
- I need some explanation on global $post [duplicate]
- How to delete all posts with dead image urls?
- Numbering author posts in posts query
- How to run select query of post with category and tags?
- Querying posts from current category, using a variable as array argument
- Query posts from newest category
- Sort Events by Venue Title – Sort Post set by related post ids
- wp query custom orderby not custom field
- Query post for today, if no post get the previous one
- Custom Select Query pagination not working properly
- Query post by meta key of another table
- Sort / Filter Queries
- Query post category & remove any post id
- Display the latest post from some selected authors
- Add something after all sticky posts in The Loop
- Advanced Post Display/Pagination/Ordering
- Ordering posts alphabetically by meta keys and title
- Why I obtain this WP_Query strange behavior trying to select posts having a specific tag?
- Why I have this strange behavior when I try to exlude the featured post from posts visualization?
- Grab next post title in archive page
- Removing a post from the results of a WP Query
- Query posts from a specific category and selected tag
- Continuous listing from a custom field
- Displaying Results From Custom Taxonomy Query
- Sort post by category using HTML Select tag
- How to store post rating system data post independent?
- Get first comment link on the post itself
- WP_Query retrieve custom posts but not the post showing
- Special Query: Title, Terms, Content – %LIKE%
- Creating pages and getting their values from the database table
- Make division in post_query?
- How to limit post query to only return a total count of items with certain post statuses?
- How to change text (date) in post base on the day
- Display one post randomly from category on home page
- How to set value in Query Loop?
- Wp_query WooCommerce products
- The page that displays Posts on homepage
- query_post or single-[cpt].php?
- Need to show birthday of custom post type(Famous people in this case) in elementor. Date of birth set in custom fields
- Display posts with id equal to relationship value
- Sort Posts Alphabetically Based on Specific Category (Divi)
- Change permalinks in posts via SQL
- I am using the query block and what I want and see on the editor page is not the same with the actual results
- Batch Scanning and Deleting Empty WordPress Posts
- Add a category to posts, that DO NOT contain two specific keywords?
- How to make WP_Query faster when getting a post from one year ago?