Make WordPress Core

Opened 4 months ago

Last modified 9 days ago

#59809 new defect (bug)

Inconsistent "ITEMS PER PAGE" across pagination pages in the Query Loop

Reported by: rajinsharwar's profile rajinsharwar Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Query Keywords:
Focuses: Cc:

Description

There is an inconsistent behavior of the "ITEMS PER PAGE" across pagination pages in WP 6.4 and TT4 the Query Loop block.

Here is how to replicate it:

  1. Ensure you have WP 6.4-RC3 installed, and the TT4 activated.
  2. Ensure you have at least 10 blog posts.
  3. Make a certain blog post sticky.
  4. Navigate under Appearance > Editor, and edit any template.
  5. In the template, add the Query Loop block, and choose a pattern that has pagination on it.
  6. Disable the "Inherit query from template", and ensure the "STICKY POSTS" is set to include. Also, ensure the "ORDER BY" is set to "Newest to Oldest"
  7. From the "Display Settings" of the block, set the "ITEMS PER PAGE" to 2.
  8. Save the changes, and come back to the frontend.
  9. You will see that it shows 3 posts in the Query Loop, which is expected as it includes the Sticky post as well.
  10. Now, navigate to the 2nd page using the pagination. See, now you will see 2 posts. This includes the STICKY post and another post.
  11. Now, navigate to the 3rd page using the pagination. See, now you again have 3 posts showing, which is expected.

This is causing an issue with the 2nd page of the pagination, which is only showing 2 posts, including the Sticky one. But all the other pagination pages are showing fine, with 3 posts each, including the Sticky one. This is occurring in WP 6.4 and with the TT4 theme.

Change History (10)

This ticket was mentioned in Slack in #core-editor by rajinsharwar. View the logs.


4 months ago

#2 @peterwilsoncc
4 months ago

@rajinsharwar Thanks for the report.

I am having trouble reproducing the issue, these are the steps I followed:

  1. Empty site and create some posts via wp-cli commands
wp site empty
wp post generate
## Make sure post ID matches number
for i in {1..100}; do wp post update $i --post_title="Post $i"; done;
  1. Activate TT4
  2. Edit home page, remove all sections except query block
  3. Edit query block
    • turn off inherit setting
    • post type: posts
    • order: newest to oldest
    • force page reload: off
    • items per page: 10
    • offset: 0
    • max page to show: 0
  4. Save site, exit site editor
  5. Set a post on the third page to be sticky
  6. Visit front end of site:
    • page one: 11 posts shown (ten plus the sticky)
    • page two: 11 posts shown (ten plus the sticky)
    • page three: 10 posts shown (sticky at top, it's removed from it's normal position)
    • page four: 11 posts shown (ten plus the sticky)

Are you able to provide any steps that I am missing? Feel free to upload screen shots if that will be easier.

#3 @rajinsharwar
4 months ago

Hi @peterwilsoncc, thanks for checking on this. This video might help you replicate it.
https://somup.com/c0X1IZgQIH

Here are the Unit Tests dummy posts for your reference: https://github.com/WordPress/theme-test-data/blob/master/themeunittestdata.wordpress.xml

Please make sure there is only one post made as Sticky.

#4 @hellofromTonya
4 months ago

  • Keywords reporter-feedback added

@rajinsharwar is this issue only with 6.4 and TT4? Have you also tested it on 6.3.2 and/or with TT3?

#5 @rajinsharwar
4 months ago

Yeah, in TT3 and WP 6.3.2, there is also an issue with pagination but its different. There I found many pages to have inconsistent behaviour, but with TT4, its either the 1st page or the 2nd page.

This ticket was mentioned in Slack in #core by hellofromtonya. View the logs.


4 months ago

#7 @hellofromTonya
4 months ago

  • Keywords reporter-feedback removed
  • Version trunk deleted

Thanks @rajinsharwar for confirming the issue you're seeing predates 6.4.

I'm removing trunk as the Version.

#8 @hellofromTonya
4 months ago

Following the testing instructions, I too was unable to reproduce the reported issue with 6.4 RC3 and TT4. I'll follow-up later with a proper test report to share my findings.

#9 @hellofromTonya
4 months ago

As the reported issue was not introduced in 6.4, this report is not a blocker for 6.4.0 release.

#10 @poena
9 days ago

  • Component changed from Bundled Theme to Query
  • Summary changed from Inconsistent "ITEMS PER PAGE" across pagination pages in WP 6.4 and TT4 for the Query Loop to Inconsistent "ITEMS PER PAGE" across pagination pages in the Query Loop

This happens with the query loop block in both classic themes and block themes.
This is a not a problem with the bundled themes, so I am going to remove it from the bundled theme component.

There are similar issue already reported, but I did not find an exact match.

https://github.com/WordPress/gutenberg/issues?q=is%3Aopen+is%3Aissue+label%3A%22%5BBlock%5D+Query+Loop%22+sticky

https://core.trac.wordpress.org/ticket/50989

Note: See TracTickets for help on using tickets.