#13365 closed defect (bug) (duplicate)
WP_Query, author_name, and sticky posts
Reported by: | eryanv | Owned by: | ryan |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 2.9.2 |
Component: | Query | Keywords: | reporter-feedback dev-feedback |
Focuses: | Cc: |
Description (last modified by )
I have a template which is being used as my front page on WP 2.9.2. In this template I setup my loop with the following code:
$postresults = new WP_Query(); $postresults->query("author_name=frontpage&post_types=post&post_status=publish"); while($postresults->have_posts()) { $postresults->the_post(); ?> // etc...
I am not using the "caller_get_posts=1" option, but my sticky posts are still showing up in order with other posts rather than at the beginning. If I remove the "author_name=frontpage" the sticky posts will move back to the first items, however I am stuck with posts by authors I do not want. Using "author=2" results in the same behavior as using "author_name".
Change History (7)
#3
@
13 years ago
- Keywords reporter-feedback added; sticky loop author removed
Please explain what you expect to happen instead.
#4
@
13 years ago
- Cc pavelevap@… added
Today I also came into this problem. On our website there are several sticky posts.
I tried to do custom loop (posts on page) with WP_Query(). But there were not only posts related to arguments, but also all sticky posts. I found caller_get_posts and set it true and everything was OK. But it is not very user-friendly solution, for all my loops I have to add this parameter... Maybe ignoring sticky posts for custom loops? But on the other side I understand its current behaviour... But for many users it is not very clear on the first look...
Maybe related: http://core.trac.wordpress.org/ticket/14825
#5
@
12 years ago
- Keywords dev-feedback added
Stickies will only show up if the query does NOT meet any of these conditions:
$this->is_singular || $this->is_archive || $this->is_search || $this->is_feed || $this->is_trackback || $this->is_404 || $this->is_admin || $this->is_comments_popup || $this->is_robots
This is unbelievably confusing since is_archive
expands to:
$this->is_post_type_archive || $this->is_date || $this->is_author || $this->is_category || $this->is_tag || $this->is_tax
Once you start adding query parameters, some of these condition get met immediately.
#6
@
11 years ago
- Milestone Awaiting Review deleted
- Status changed from new to closed
I have a lot of sticky knowledge now - they only show up if WP_Query::is_home
is true
and the page number is 1. My patch on #11950 wouldn't even solve this as is. include_sticky
from #11950 needs to force the adding of stickies to page 1.
I am going to mark this as a duplicate of that and focus the work there - which is: manual control of sticky INclusion.
Another sticky post related #12702