Skip to content

REST API: Add excerpt_length collection parameter to posts controller - #16511

Closed
t-hamano wants to merge 1 commit into
WordPress:trunkfrom
t-hamano:66940-rest-excerpt-length
Closed

t-hamano wants to merge 1 commit into
WordPress:trunkfrom
t-hamano:66940-rest-excerpt-length

Conversation

@t-hamano

@t-hamano t-hamano commented Dec 4, 2026

Copy link
Copy Markdown
Contributor

Registers the excerpt_length parameter on post collection endpoints, for post types that support excerpts. It was previously registered only on the single post endpoint, so blocks that list several posts in one collection request, such as the Latest Posts block, could not use it as a documented and validated parameter.

Gutenberg PR: WordPress/gutenberg#87973

Trac ticket: https://core.trac.wordpress.org/ticket/66940

Use of AI Tools

AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 5.5
Used for: Applying the patch, writing the commit message, and drafting this PR description.


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

Collection requests for post types that support excerpts now accept the `excerpt_length` parameter, which was previously available only for single item requests.

See #66940.

Co-Authored-By: Claude <noreply@anthropic.com>
@t-hamano
t-hamano marked this pull request as ready for review December 4, 2026 11:17
@github-actions

github-actions Bot commented Dec 4, 2026

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs.

Core Committers: Use this line as a base for the props when committing in SVN:

Props wildworks.

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


Props Bot commands

You can trigger Props Bot actions by commenting on this PR:

  • @propsbot add <username> to give props to a GitHub or WordPress.org user. Requires write access.
  • @propsbot remove <username> to leave a user out of the props. Requires write access.
  • @propsbot refresh to refresh this list. Adding the props-bot label works too.

@github-actions

github-actions Bot commented Dec 4, 2026

Copy link
Copy Markdown

Test using WordPress Playground

The changes in this pull request can previewed and tested using a WordPress Playground instance.

WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Some things to be aware of

  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

wporg-sync pushed a commit that referenced this pull request Dec 4, 2026
Registers the `excerpt_length` parameter on post collection endpoints, for post types that support excerpts, with the same definition as the single post endpoint. Requests that list several posts can now ask for an excerpt at a given length through a documented and validated parameter, without filtering the excerpt length globally.

Developed in #16511

Follow-up to [58065].

Props swissspidy, wildworks.
Fixes #66940.

git-svn-id: https://develop.svn.wordpress.org/trunk@65918 602fd350-edb4-49c9-b593-d223f7449a82
@github-actions

github-actions Bot commented Dec 4, 2026

Copy link
Copy Markdown

A commit was made that fixes the Trac ticket referenced in the description of this pull request.

SVN changeset: 65918
GitHub commit: 392e9af

This PR will be closed, but please confirm the accuracy of this and reopen if there is more work to be done.

@github-actions github-actions Bot closed this Dec 4, 2026
wporg-sync pushed a commit to WordPress/WordPress that referenced this pull request Dec 4, 2026
Registers the `excerpt_length` parameter on post collection endpoints, for post types that support excerpts, with the same definition as the single post endpoint. Requests that list several posts can now ask for an excerpt at a given length through a documented and validated parameter, without filtering the excerpt length globally.

Developed in WordPress/wordpress-develop#16511

Follow-up to [58065].

Props swissspidy, wildworks.
Fixes #66940.
Built from https://develop.svn.wordpress.org/trunk@65918


git-svn-id: http://core.svn.wordpress.org/trunk@64947 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants