NO BUG: Show sticky posts for a single term in a query loop

i have a page that I am only including 1 term (for a standard blog post - the term is a custom taxonomy).
The issue I am having is that if I have sticky posts in that term. The sticky posts are not moving to the front.

Example: I am showing 15 most recent posts for that term. BUT I also have 3 sticky posts that have that term attached to them. The sticky posts are not being shown at the front of the query loop - in fact they are ignored if there are not within the first 15 posts for that term.
Troubleshooting Sticky Posts in Bricks Query Loops with single term filter
Watch Video

Is this a bug?

Hi,

so, let’s test something. If you enable one of the default themes (Twenty Twenty-Four or similar), and then you got to that term archive page, are the sticky posts on the top?

Matej

its not a term archive page so I don’t thnk it would… it just. a query loop on a service page

Hi @dsgadmin,

sorry, I thought it was a main query for the term.

But, saying that, it’s just WP behavior, and honestly, I don’t know why. When you do a custom query with a “tax_query”, “cat” or similar, it will cause WP_Query::is_home to be false. And if this is false, it does not include sticky posts, regardless of the ignore_sticky_posts option.

I’m not sure why it’s that, but that’s how it works. You can refer to the 3501 line here, if you want to check it :slight_smile: WP_Query – Class | Developer.WordPress.org

I’ll mark the topic as no bug because of that.
Matej

Ensure Sticky Posts are Assigned Correctly

to my knowledge they are set correclty

understood… thank you for confirming this.

1 Like