NO BUG: Query Order Not Working

Running latest Bricks, this loop is native nothing added.

Had this on a few sites lately, been copying the query looped element and pasting it in, saving, refreshing, and odd behaviour like load more and WPGB facets then suddenly work again, feels buggy.

Today I found this on a site I’ve not touched in a few months, that was working fine when I launched it and have added no plugins since.

Basically I set the count to 6, but it’s loading 7, and it’s sandwiched two posts from October around the others from Nov? Very strange.

Please see: Recordit: Record screencasts fast & free! with GIF Support!

Browser: Chrome 110
OS: macOS / Windows / Linux / etc.
URL: Link to a page that illustrates this issue
Video: Short screen recording that illustrates this issue (free tool: jam.dev)

[Please describe this bug in as much detail as possible so we can replicate & debug this bug]

Hi Rob,
Could it be that the additional posts are “sticky”?

You can exclude “sticky” posts from the query by activating the corresponding toggle.

Best regards,
timmse

Possibly Tim, yeah? Does that then override the count of 6 as well? If so, I would say that option should be default no, with the ability to enable ‘include sticky’?

Just thinking it would sabotage all layouts otherwise.

Is there a way to target a sticky post too @timmse ? So we could at least make it obvious it was a sticky one? :slight_smile:

Should this not still keep to the count of 6 though, and then just show 5 other posts instead of 6 as one of the count is sticky?

It’s the default WordPress query behavior:

ATTENTION If you use sticky posts, they will be included (prepended!) in the posts you retrieve whether you want it or not. To suppress this behaviour use ignore_sticky_posts .

14 years working with Wordpress, I never knew that and not something I’ve had an issue with ever, but thanks for making me aware! I also didn’t know it overrides the post count value, which seems odd to me.

So there’s no class or identifier which allows us to see which are sticky int the loop in any way?

Each of us should learn something new every day :slight_smile:

No, not by default. However, you could write a function that checks whether a post is sticky and then assign a class to it in order to highlight it. You can use this to check whether a post is sticky or not, or alternatively use it in the query editor so that only sticky posts are output.

'post__in' => get_option( 'sticky_posts' )

1 Like