From the function reference for get_posts()
:
For full parameters list see
WP_Query
.
From the WP_Query
reference:
ignore_sticky_posts (boolean) – ignore sticky posts or not (available with Version 3.1, replaced caller_get_posts parameter). Default value is 0 – don’t ignore sticky posts. Note: ignore/exclude sticky posts being included at the beginning of posts returned, but the sticky post will still be returned in the natural order of that list of posts returned.
So, with that, if you add ignore_sticky_posts => 0
to your array of arguments being passed to get_posts()
your sticky posts should be output at the top as expected.
Related Posts:
- Is it necessary to reset the query after using get_posts()?
- Post Loop not Returning Permalink
- Get posts that matches specific terms of multiple custom taxonomies
- Is get_posts() more efficient than The Loop?
- How to get_posts where ‘menu_order’ is more than 0/zero?
- Display the_content on click jquery
- What is the maximum number of posts a WordPress loop can work with?
- Why only one post (and no pagination) on this variation of the loop?
- Sort posts by most recently modified
- A smarter way to display multiple loops inside a page template
- Get all posts including sticky ones with get_posts(),setup_postdata(), and foreach loop?
- Show all posts using the template page and the loop?
- Showing sticky posts with get_posts()
- query_posts() vs get_posts() multiple loops [duplicate]
- How do I paginate a get_posts() request inside another page loop (Paginating childpages)
- Both a page loop and posts loop on the same page
- How to get The Loop working with $wpdb->get_results()
- Multiple get_posts() queries on one page
- 404 Template customization | Want 10 recent Post on the 404.php error page apart from the error Notice
- Output meta into arrays
- Get post offset/posts page offset in single post page (outside the loop)
- loop inside a loop : search for posts in the same category
- php loop error for count posts in category
- numberposts not responding to wp_reset_postdata()
- get_posts and wp_autop (remove filter)
- Need some help with “the_widget()” function
- Is there a way to target only images within the loop?
- Show last post from multiple categories using wp_list_categories
- Question about custom plugin
- How to display Yoast SEO meta description in archive template for each post instead of the_excerpt()? [closed]
- Why do themes rely on “The Loop”?
- How to place comments_template(); outside the loop?
- Endless loop with wp_insert_post and wp_update_post
- Hook into the loop via a plugin, and output something after every X post?
- Two custom loops, pagination, offset
- Access to Media Library
- Getting two wp_link_pages output
- post loop causes wp_users and wp_usermeta DB queries for each users
- Run The Loop over array of post objects
- Enable infinite scroll on single.php [closed]
- How to loop through ALL pages?
- Does get_template_part pull data once in a loop?
- Get titles of all posts with current tags except current post
- How to retrieve “sticky” post outside the “loop”?
- Using get_the_excerpt() Before The Loop
- code suddenly appearing from my tempate second loop
- Get post/page data outside the loop
- wp_query inside the_loop
- How to go about combining dropdowns / filter queries?
- woocommerce get_price_html not pulling in correct price
- How to fix pagination for custom loops?
- How to display posts by vote count and if no value continue with latest posts with no votes?
- Sort results by groups of numbers and letters
- Modify the main loop to display current month / year
- Display post list with different styles
- Problem with displaying HTML content after in_array [closed]
- Loop for sticky posts
- Get author_id in wordpress
- Single.php different behaviour from admin to non-admin
- Array ids post to function have_post
- Can’t access PHP array inside script localization from javascript
- Give each posts in a loop a number in sequence
- custom post on homepage
- get_comments with post_status ‘public’ retrieves NULL result
- Content Visibility for WordPress is not working (Drafts, public etc.)
- I have broke my pagination, same posts on all pages (index.php)
- Filter existing hook using parameter and foreach loop
- Run “the loop” in a random order
- Show terms in archive page
- For Each +1 WordPress Loop
- Loops for cat links not looping for wordpress site
- Skip 5 latest post while paging?
- WordPress: query pages except remove one page
- get_post_meta printing empty fields, but it shouldn’t be
- Sort posts according to a numeric value entered with ACF
- wp_get_attachment_url not fetching URL?
- get the value for ALT is we check to see if an actual ALT value is set, if not we use the caption and if no caption is set we use the title
- how to add 4 post in one carousel slide
- How to get all multi-select user meta values and add them to an array?
- Exclude Posts Using Meta Query and User Meta
- Is “the loop” a template tag?
- Can I temporarily disable global $post?
- Shortcode for pulling specific Post Title outside loop when ID is passed in
- Show a list of user posts in the user admin page
- WordPress with woocommerce custom query
- Create a hierarchical loop at predefined markup requirements
- Page gets displayed in post field
- Active class for my flexslider in WordPress
- WordPress loop only displays 5 articles max?
- get_template_part() to render single page Theme
- Can’t see custom field after the Loop [closed]
- Showing related posts (custom post type) outside of the loop
- Same Loop on Multiple Pages
- Least Number of Loops to Create Custom Homepage?
- The Loop for my theme with static front page is not working
- WordPress loop: Display if posts exist
- tax_query not working properly with get_posts
- Showing ads after posts in home page
- Prevent duplicating specific column from database table
- Hook in the loop after the first post