You can try this:
$args = array(
'post__not_in' => get_option( 'sticky_posts' ),
'posts_per_page' => 5,
);
$recent = new WP_Query( $args );
to exclude the sticky posts. You can read more about it here in the Codex.
Related Posts:
- Exclude post ID from wp_query
- How to filter by category in REST API, excluding posts also in other category term?
- Get attached media only
- Query Ignoring ‘exclude’ Parameter?
- WP_Query Excluding pages with Order is 0
- Query: offset post list, unless it’s a specific category
- Excluding pages in WP_query using ACF
- Exclude Category filter from Portfolio section
- Avoid repeated post on page 2 when excluding one on page 1
- 2 wordpress loops showing 1 post from same post type – how to avoid showing the same post?
- Include posts from some categories while excluding from others
- Exclude current post from an array of posts?
- Exclude recently updated post from custom WP_Query using multiple loops
- specific post is not excluded from the loop
- Paginate wp_query while utilizing post__not_in
- WP Query Obj: Set value to be unequal | Hide media by admin
- why ignore_sticky_posts in sticky post query
- WP_Query by post ID doesn’t work if post is in custom post_status
- Tracing the life of a query
- WP_Query orderby taxonomy term value (numeric)
- Finding all results from database within 500 miles of the given latitude and longitude [closed]
- How to get post meta value and post in one query?
- WP Query and order by particular specified IDs
- Woocommerce custom loop to show all the products [closed]
- Get the post permalink within the loop but without additional DB query
- Pagination 404 errors for author posts query on author.php
- List the 5 most recent child pages
- Display revision if post status is pending
- How To Remove/hide some specific categories from two different categories widget from sidebar
- WP Query search for attachments and their exact title
- How to add another parameters to WP_Query?
- Display link to taxonomy archive only if it has posts with certain custom field values
- WP_Query compare with dynamic values
- WP Rest API max limit include parameter?
- Adding multiple post queries with parent and children to page – Best Way
- Programmatically set ‘meta_query’ for filter
- Display posts with date wordpress default
- WP Query Exclude and Start by Menu Order Offset
- Query total number of posts
- Category attribute not working in custom shortcode
- How to display a posts 1 year ago with custom WP_Query loop?
- WC displaying products from category
- Show all post for a given category
- WP_Query create html structure
- How is WP_Query parsed to determine which template to request?
- pagination with numbers for WP_User_Query
- Stuck in the query loop
- Filter wordpress post categories with jquery/ajax and pagination?
- Include current post into loop
- How to display the featured image for each post?
- How do I amend wp_query before it is run/executed?
- Post Thumbnail URL isn’t pulling into the background of div
- Highlight post in sidebar on single page
- Specify strict ‘order by’ in WordPress query
- Single field to search for matches on post ID or meta values
- Getting rid of unwanted nonSQL syntax characters when debugging a query
- Meta query compare for ID’s greater than specific ID
- Using post_where filter only on main query NOT sidebard new WP_Query
- How to avoid bypass of search bar rules?
- Slider won’t work with custom query
- wordpress udpate query not equal to
- How to generate feed for custom template
- WP_Query with one category in args shows other categories
- WP Query – filtering terms with regex
- Custom navigation : show posts in sets of 4
- WordPress WP_Query compare not working?
- Excluded category from loop
- Add content depending on page loaded
- Custom template for password protected page
- Having a variable based on $post_count increase when i move to the next page of results
- Post order by custom fields
- WP Query and multiple pages
- How can I do a orderby by the number of items? So basically list by starting with the array with the largest number of post
- How do you do a meta query on an encrypted field?
- meta_query with meta values as serialize arrays
- Multiple WP_Query args combinations according to post type
- wp_set_object_terms() custom taxonomy not working correctly when using insert post
- in_the_loop() issue with custom query
- Pagination inside the blog page not working
- How to restrict add media library only to images of the same post family?
- Is my code correct?
- Wp Query sort order
- get_posts query caching?
- wp_query returns match with no criteria
- Adding additional taxonomies to wordpress taxonomy page
- why doesn’t this pre_get_posts code work?
- pre_get_posts with WP_Query to prevent posts from specific tags
- How can I modify standard search query to include also ACF custom fields values?
- Best way to Order Post in Home without a plugin
- Retrieving category pages from subcategory returns empty sets
- Loop through multiple custom fields with increasing number
- Different number of posts showing in development vs production server
- Order WP_Query results in order other than ASC or DESC
- More efficient query to display posts in same sub-category?
- Get post closest to today
- Get WP_Query query after execution?
- Pagination in custom query not working [duplicate]
- $query_args for loop to only get posts from “current category”?
- How can I get taxonomy term name using term slug & post ID using build in WordPress function or class?
- Why does wp_query only display the most recent post when using order ASC?