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
- Meta_query compare operator explanation
- meta_query ‘compare’ => ‘IN’ not working
- Multiple WP_Query loops with Pagination
- Sorting: custom query with orderby meta_value_num THEN by title
- WP_Query and next_posts_link
- WP_Query with checkbox meta_query
- Too slow when using both ‘tax_query’ and ‘meta_query’ both in WP_Query
- How can I save an array from a random post sequence for later use?
- How to order category.php loop by ‘meta_value’?
- Add inline HTML to posts published within last 24hrs
- Move posts to top of WP_Query if in certain Taxonomy?
- Display different number of posts from one category on the different pages
- Pagination not working Search posts
- How to count data records in wordpress which have same meta_value in wp_postmeta table?
- wordpress query in header won’t reset and corrupts other loops
- Get image of latest post from taxonomies/categories
- 2 loops on page – one with orderby rand second orderby date
- Undefined WP_Query::has_posts()?
- Create ONE callback for all page templates, post filter queries + paginated pages, triggering pagination via AJAX
- wp_query not searching with apostrophe
- How to use WP_Query to display many posts?
- Counter problem, infinite loop when post_per_page equals X
- Custom query based on meta key – Reduce three states to two in results?
- Five posts from a category in footer
- How to get all unique categories for posts in loop?
- How to display multiple custom fields with the same meta_key in an ascending order?
- Using the_post_thumbnail resets current loop item ID
- Meta_query with multiple keys and multiple values
- Order by empty custom field
- Help ordering Post loop by two meta values
- WP Query to have sticky posts first, with pagination and having a joint ‘posts per page’ arg with main loop
- New WP_Query loop in admin causes problems
- Issue with front page navigation after upgrading to 3.4
- Query posts only without featured image
- Exclude recently updated post from custom WP_Query using multiple loops
- get_posts output always same post
- How to use WP_Query() on single.php?
- Stomping WP_Query in author archive to facilitate pagination with custom queries
- Loop increase in while loop not working
- Is this meta query problematic?
- posts archive page – closing WP_Query loop correctly [closed]
- Appending to existing WP_Query’s meta_query if exists
- AJAX Breaking Offset Argument In WP Query
- Continue or break the while loop
- Loop posts based on permalink term
- Get meta_value of a specific meta_key from all posts belonging to a specific custom type
- Nested array issue in meta_query
- Does putting queries within loops cause an issue on WordPress?
- Function using get_posts() with tax_query not working when called from functions.php
- How to get current page nearest parent id?
- meta_query with array as value with multiple arrays
- Why doesn’t my WP Meta Query return any results?
- How to make the ‘request’ filter work?
- Pin posts to top of custom loop
- how to get custom attachment url?
- Get posts having meta value between two numbers
- How to set meta_query if get_post_meta returns nested array for that key? [duplicate]
- Sorting with meta_query and multiple, optional meta keys
- WP_Query & Duplicate entries
- WP_Query how to add a thumbnail to the first post from the last 5 posts?
- query_posts() doesn’t seem to be called in my page
- WP_Query returns empty if meta_query has more than 7 values
- Using orderby with 2 meta keys
- Next / previous posts link doesn’t show up with Posts 2 Posts
- Passing conditional arrays to WP_Query() [closed]
- Carousel Loop only duplicating
- How to show featured post first, then separate loop for other posts
- Get all user with both meta_value
- Using ‘meta_query’ with the ‘pre_get_posts()’ hook disables searching for post titles
- Woocommerce set loop_shop_columns to be 3 in the main shop page loop only and 4 otherwise
- Get posts using multiple values from ACF checkbox as meta query wordpress
- Why ignore_sticky_posts argument is in sticky post query?
- WP Query returning all posts when Meta_query is null