Skip to content

Fix/query default posts per page#77993

Open
pranvinit wants to merge 5 commits into
WordPress:trunkfrom
pranvinit:fix/query-default-posts-per-page
Open

Fix/query default posts per page#77993
pranvinit wants to merge 5 commits into
WordPress:trunkfrom
pranvinit:fix/query-default-posts-per-page

Conversation

@pranvinit
Copy link
Copy Markdown
Contributor

What?

Closes #77886

Allows the Query Loop block’s default query type to override “Items per page”.

Why?

Default Query Loop blocks inherit the current template query, but users could not reduce the number of displayed posts for archive templates without custom code.

How?

Shows the “Items per page” control for inherited queries and applies query.perPage when rendering inherited Query Loop results, pagination, totals, and no-results state.

Testing Instructions

  1. Set Settings > Reading > Blog pages show at most to 10.
  2. Create or edit an author archive template.
  3. Add a Query Loop block using the Default query type.
  4. Set Items per page to 3.
  5. Confirm the template shows 3 posts while still filtering to the current author.

Testing Instructions for Keyboard

  1. Select the Query Loop block.
  2. Use keyboard navigation to open the block inspector.
  3. Set Query type to Default.
  4. Navigate to Display > Items per page and change the value.
  5. Confirm the setting updates and remains usable by keyboard.

Screenshots or screencast

N/A

Use of AI Tools

AI tooling was used to help draft and implement the change. The code was reviewed before submission.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 6, 2026

Warning: Type of PR label mismatch

To merge this PR, it requires exactly 1 label indicating the type of PR. Other labels are optional and not being checked here.

  • Required label: Any label starting with [Type].
  • Labels found: .

Read more about Type labels in Gutenberg. Don't worry if you don't have the required permissions to add labels; the PR reviewer should be able to help with the task.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 6, 2026

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: pranvinit <pranavyeole@git.wordpress.org>
Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>
Co-authored-by: bradhogan <bradley2083@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@github-actions github-actions Bot added the [Package] Block library /packages/block-library label May 6, 2026
@Mamaduka
Copy link
Copy Markdown
Member

Mamaduka commented May 6, 2026

Thanks for the PR, @pranvinit!

The referenced issue isn't a bug, at least not as the Query block currently works. Default queries will use per_page from settings, which is usually 10.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package] Block library /packages/block-library

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Query Block: cannot change number of items for "default" query type

2 participants