WordPress / gutenberg

The Block Editor project for WordPress and beyond. Plugin is available from the official repository.
https://wordpress.org/gutenberg/
Other
10.3k stars 4.11k forks source link

Query Block: perPage being ignored #55317

Open bradhogan opened 10 months ago

bradhogan commented 10 months ago

Description

When using a query block on a single template (i.e. to show more articles for a user to browse), the query "perPage" parameter is not working properly. This happens with the default theme and only Gutenberg active.

Step-by-step reproduction instructions

  1. Make sure you have 5 or more posts
  2. In the site editor, edit the single template
  3. At the bottom of the single template in the site editor, add a query block
  4. Set the query block to show 3 per page, do NOT inherit query from existing template
  5. Save the template, view one of your posts in the front-end
  6. Notice that the query block at the bottom shows more than just the 3 articles

Screenshots, screen recording, code snippet

No response

Environment info

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

github-actions[bot] commented 9 months ago

Hi, This issue has gone 30 days without any activity. This means it is time for a check-in to make sure it is still relevant. If you are still experiencing this issue with the latest versions, you can help the project by responding to confirm the problem and by providing any updated reproduction steps. Thanks for helping out.

4hiroramos commented 1 month ago

Hi, thank you for your issue. I've tried it, and I see why you mentioned it as a problem. However, that didn't matter at all. I think this is a different problem.

tbshiki commented 1 month ago

Hi, I tried to see if the same situation would occur. Environment tested:

This was in an environment with more than 5 posts created. I added a Query Loop block and set ITEMS PER PAGE to 3 without selecting a template. When set to 3, only 3 posts were displayed, and when set to 4, only 4 posts were displayed. I believe this behavior is correct. I'm not certain, but is it possible that STICKY POSTS are affecting this? When I set STICKY POSTS to Exclude, the sticky posts were not displayed, and the number of posts shown matched the specified display count. I think this behavior is also as expected. Thank you.