#55444 closed defect (bug) (duplicate)
Sticky posts are limited to 5
Reported by: | spacedmonkey | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | Posts, Post Types | Keywords: | reporter-feedback |
Focuses: | Cc: |
Description
The call to get sticky posts in WP_Query uses get_posts
. As no limit is sent, the default limit to 5 posts. This means, that is the site has 15 sticky posts, only 5 sticky posts will ever be shown on the front end.
Change History (4)
#3
@
3 years ago
I have reproduced the issue with these steps:
- Switch the theme to Twenty Twenty-One, as Twenty Twenty-Two seems to ignore sticky posts for some reason.
- Create 10 sticky posts.
- Create 10 non-sticky posts.
- On the home page, there are now 10 non-sticky posts and 5 sticky posts (instead of 10).
It looks like this was introduced in [52982] / #36907 as a result of removing the 'nopaging' => true
argument from the get_posts()
call in question. It's not quite clear why it was removed, as neither the ticket nor the commit message mention the removal. With 'nopaging' => true
restored, all 10 sticky posts are displayed as expected.
This seems like a backward compatibility break, so I have reopened #36907 with a patch.
Note: See
TracTickets for help on using
tickets.
Hello @spacedmonkey what are the steps to reproduce the bug please? I created six posts and made all of them sticky, I created a block page, use query loop to show only stickies posts and then I go to front page and all my six stickies posts are show up.
So how can I reproduce the bug here? Thanks.