You need to set ignore_sticky_posts
to true
in your query arguments. This way you exclude sticky posts and only focus on the post ID’s array being passed to post_in
'ignore_sticky_posts' => true,
EDIT
If this does not make much sense, please see my answer here to similar question where I have explained it a bit better. Be sure to check it out
THE CODE
$r = new WP_Query(array(
'posts_per_page' => 5,
'post__in' => $sticky,
'meta_query' => array(
array(
'key' => '_thumbnail_id',
'compare' => 'EXISTS',
),
),
'post_status' => 'publish',
'orderby' => 'post__in',
'post_type' => array( 'post' ),
'ignore_sticky_posts' => true,
));
Related Posts:
- Display products from specific category in shop page
- In loop: posts have thumbnail AND other variables
- Exclude post on loop by multiple meta key value
- How to query ‘posts_per_page’ to display a different blog posts index template?
- WP_Query doesn’t get sticky post at the top, when used in a page template
- WP_Query on custom field and order results
- Show Sticky Post at the top but do not show again in the loop?
- Any number in meta key (wp query)
- WP_Query condition affects posts_per_page count
- Array as ‘key’ in WP_Query
- How to display the featured image for each post?
- How to provide meta_key array to wp_query?
- Wp_query with 2 meta keys and array of meta values
- Meta query compare for ID’s greater than specific ID
- How to remove only the latest sticky post from the loop
- Use have_posts() with array of post results retrieved by $wpdb->get_results
- WP_Query not returning correct result with meta_query parameter
- How can I have sticky posts while ALSO showing posts from a specific category using one WP_Query?
- show most viewed post
- Meta Query if Values Don’t Exist
- WP_Query causing links to not work
- Custom loop – Isolating post meta output depending on current query taxonomy terms
- Display First posts without the default featured image
- Multiple loops on index page with sticky post and pagination
- First post outside of loop, homepage only?
- How can I display sticky posts at first in wp_query?
- Display only posts with thumbnails
- Post Query with Meta Query no longer working
- Meta_query compare operator explanation
- meta_query with meta values as serialize arrays
- Nested meta_query with multiple relation keys
- Can I force WP_Query to return no results?
- Resetting post data to previous loop in nested loops
- Some doubts about how the main query and the custom query works in this custom theme?
- meta_query ‘compare’ => ‘IN’ not working
- Query posts only with featured image
- Get post count of current loop when using multiple queries on one page
- why ignore_sticky_posts in sticky post query
- Multiple WP_Query loops with Pagination
- Using a custom WP_Query with get_template_part loop
- Use REGEXP in WP_Query meta_query key
- WP Query Args – Title or Meta Value
- Meta query with string starting like pattern
- compare meta_query in get_posts arguments
- How to query posts based on lat-lng coordinate as post meta?
- WP_Query vs get_posts
- how to show posts that are missing a meta_value
- Set Alias for meta_query arguments in get_posts()
- Sorting: custom query with orderby meta_value_num THEN by title
- Loop within a loop?
- WP_Query and next_posts_link
- Show posts without term
- Usage of the new “posts_clauses” filter in WordPress 3.1?
- How to list some posts first in the loop based on post id
- WP_Query: Why is sticky post not first item in loop?
- Pagination returns 404 after page 20
- Make loop display posts by alphabetical order
- Query *only* sticky posts
- WP_Query: query posts by ids from array?
- Use WP_Query with have_posts()?
- How to Compare Two Meta Fields
- Changing the meta_query of the main query based on custom query_vars and using pre_get_posts
- get custom post type by tag
- Does tax_query really beats meta_query in all situations?
- How to get order of posts?
- Order posts by ID in the given order
- WP_Query with checkbox meta_query
- ACF Relationship Field Search Filtering [closed]
- Add indexing to meta_value in wp_postmeta
- Is it possible to orderby multiple meta_keys when using meta_value_num?
- Custom WP_Query order by post_meta and (author) user_meta
- Sticky Posts & Posts Per Page [closed]
- Query WooCommerce orders where meta data does not exist
- Too slow when using both ‘tax_query’ and ‘meta_query’ both in WP_Query
- get_template_part in for loop
- Getting attachments by meta value
- Query Multiple Post types each with own meta query
- Get array of posts from the current archive page loop
- pre_get_posts with get_posts
- How-to exclude terms from the main query the most performant way?
- Pagination with WP_Query is buggy – working for some pages, but not the others
- Get the number of posts from the current page results
- Execute a large WP_Query with many “AND” Meta_Queries?
- Executing Queries in tag.php
- Display posts the match taxonomy term linked from wp_list_categoies?
- How can I save an array from a random post sequence for later use?
- How to place a loop within another loop?
- WordPress Custom Query to show posts from last x years
- Query all posts where meta value is empty
- How to order posts tag by tag?
- WP_Query min and max values
- Query Custom Meta Value with Increment
- “pre_get_posts” firing on every query
- Show two random posts from custom post type
- Add the “active” class only to the first loop item in a WordPress query [closed]
- Loop through all tags & output posts in alphabetical list
- ACF datepicker meta_query Compare Dates in m/d/Y g:i a – Not in Ymd Format
- Pagination with 5 posts per page
- WP_Query using meta_query with relation OR and orderby meta_value doesn’t work
- Using custom meta_query with relation not working as expected