WordPress.org

Make WordPress Core

Opened 3 months ago

Last modified 3 months ago

#50989 new defect (bug)

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

Reported by: wesleytech Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Posts, Post Types Keywords: close reporter-feedback
Focuses: ui 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 (5)

#1 @johnbillion
3 months 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
3 months 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 3 months ago by wesleytech (previous) (diff)

#3 follow-up: @desrosj
3 months 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
3 months 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
3 months 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.

Note: See TracTickets for help on using tickets.