Repository navigation
Editor: Add author support to the wp_block post type - #14269
Draft
fabiankaegy wants to merge 4 commits into
Draft
fabiankaegy wants to merge 4 commits into
fabiankaegy wants to merge 4 commits into
Conversation
This exposes each pattern's author through the REST API, so the editor can tell the current user's patterns apart from the rest of the site's patterns.
Test using WordPress PlaygroundThe 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
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
The view lists every user-created pattern, not only the current user's. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
t-hamano
reviewed
Oct 15, 2026
t-hamano
left a comment
Contributor
There was a problem hiding this comment.
Thanks for the PR! Since adding author support changes the behavior of wp_block beyond the REST API, I think we should add some tests:
- REST API: The blocks controller returns
authorin the response, and theauthorandauthor_excludequery parameters filter patterns by author. - REST API: A user without
edit_others_postscan't change the author of a pattern. - Deleting a user: Deleting a user without reassigning their content also deletes their patterns, and reassigning moves them to the new user. This is the same behavior as templates and template parts, but it changes how patterns work today, so a test would document it as intended.
- QUnit fixtures: The REST schema gets new
authorarguments, so the API fixtures probably need to be regenerated.
Covers the author in the blocks controller's response, filtering patterns by author, changing a pattern's author, and what happens to a user's patterns when the user is deleted. Regenerates the REST API client fixtures for the new author arguments. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Member
Author
|
Thanks @t-hamano! Added tests for all four:
|
Patterns may be used across the site, so deleting a user shouldn't delete their patterns, now that the post type supports authors. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
authorsupport to thewp_blockpost type, so the REST API returns each pattern's author. The block inserter and the Site Editor's Patterns screen use it to filter patterns by author.Sets
delete_with_usertofalse, so deleting a user keeps their patterns, as they may be used across the site. Without it, author support would makewp_delete_user()delete them permanently.Also renames the Site Editor's "My patterns" view to "Site patterns", since it lists every user-created pattern, not only the current user's.
The author is already stored on every pattern and the post type's capabilities already check it. This only makes it visible to the editor.
Gutenberg PR: WordPress/gutenberg#84680
Trac ticket: https://core.trac.wordpress.org/ticket/66307
Use of AI Tools
Drafted with Claude Code, reviewed by me.
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.