Make WordPress Core

Opened 4 years ago

Last modified 2 years ago

#50989 new defect (bug)

"Blog pages show at most" setting not working when 2 posts are made sticky

Reported by: wesleytech's profile wesleytech Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Posts, Post Types Keywords: close
Focuses: Cc:

Description

Version: WordPress 5.5
Site: https://wesleytech.com

In WordPress Settings -> Reading, for the setting "Blog pages show at most".

When a single blog post is set to sticky using the "stick to the top of the blog" setting on the blog post edit page, the "Blog pages show at most" setting is respected.

However, when TWO blog posts are set as sticky, then the "Blog pages show at most" setting is NOT respected, and an extra post gets shown on the home page.

For example, if your "Blog pages show at most" setting is set to 6, and you then make 2 blog posts sticky, then your home page will show 7 posts.

Change History (9)

#1 @johnbillion
4 years ago

  • Component changed from General to Posts, Post Types
  • Keywords close added; needs-patch removed
  • Version 5.5 deleted

I believe this is intentional behaviour.

What actually happens is if a sticky post would not otherwise be shown on the home page (eg. it's too old) then it gets inserted into the home page, which increases the number of posts. If a sticky post would be shown on the home page (eg. it's very recent) then it is simply pushed to the top, and the number of posts remains the same.

What you're seeing sounds like a combination of the two, where one post is already on the home page and one is older and being inserted as an addition.

It's not possible for the number of posts on the home page to remain static if sticky posts are added, because it means the second and all subsequent pages would have to be offset by the number of posts that are added to the homepage which wouldn't otherwise be there, which is not a simple operation. If that didn't happen then posts would be skipped as you paginated.

#2 @wesleytech
4 years ago

Ahh, yes, that would explain the behavior if the sticky posts aren't a part of the most recent number of posts as specified in the "Blog pages show at most" setting that it would cause another one to appear on the home page.

I disagree with this being closed. At the very least, I think that there should be some explanation on the "Blog pages show at most" setting in the Admin UI that lets the WordPress Admin know that Sticky posts could break the expectation, with the current standing.

In addition, even though including sticky post count in the "Blog pages show at most" setting calculation wouldn't be a simple operation, I still think it is the right thing to do and what most users would expect of Wordpress.

I see this as a bug that should be fixed. Thanks for your consideration.

Last edited 4 years ago by wesleytech (previous) (diff)

#3 follow-up: @desrosj
4 years ago

  • Keywords reporter-feedback added

@wesleytech Just wanted to confirm something. Is this an issue that started happening after updating to WordPress 5.5? Or it is just something you noticed while using 5.5?

#4 in reply to: ↑ 3 @wesleytech
4 years ago

Replying to desrosj:

@wesleytech Just wanted to confirm something. Is this an issue that started happening after updating to WordPress 5.5? Or it is just something you noticed while using 5.5?

I just noticed it after the upgrade. I do not know if this behaviour occurs in previous versions.

#5 @wesleytech
4 years ago

I just tested this on a WordPress 5.4.2 site and it exhibited the same behavior where older dated sticky posts aren't calculated into the "Blog pages show at most" setting.

#6 @hellofromTonya
4 years ago

  • Keywords reporter-feedback removed

@johnbillion What do you think about @wesleytech comment?

#7 @johnbillion
4 years ago

  • Focuses ui removed

I'll be honest and say that I'm not interested in spending time fixing this. Every subsequent page of results needs to take into consideration how many of the sticky posts are not present in the first page of results in order to a) reduce the number of posts on the front page by that number, and b) reduce the pagination offset by that number on all subsequent pages of results so as not to skip posts when paginating.

If someone wants to work on a patch feel free, but it'll need to be fully tested and it'll need to remain performant. This will also technically be a breaking change.

#8 @nicohood
3 years ago

Hey guys,
I am coming from https://github.com/WordPress/gutenberg/issues/35251 and I was told, that this issue relates to this Gutenberg bug.

I cannot really add much to this, as I have no WordPress development experience (yet). But this bug is super important in my opinion, as it will break a lot of layouts with the query block, making it effectively useless.

It would be super kind of you guys, if you could have one more look at this. :-)

Cheers
Nico

#9 @davidspeyer
2 years ago

This bug is still not fixed. I also think that this is very important!

Note: See TracTickets for help on using tickets.