-
Notifications
You must be signed in to change notification settings - Fork 4.6k
templateLock: contentOnly - support content block insertion #73425
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
templateLock: contentOnly - support content block insertion #73425
Conversation
…ion, only treat the top-level content locking block as the one true section
|
Size Change: -7 B (0%) Total Size: 2.51 MB
ℹ️ View Unchanged
|
|
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 If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
tellthemachines
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for fixing this! Code LGTM and works as expected ✅
|
Before2025-11-20.16.54.03.mp4After2025-11-20.16.54.35.mp4 |
|
Thank you for this :) such a massive win! |
|
@t-hamano I'll have a look at putting a fix together. From what I can tell it's not a bug caused by this PR, I think it might be existing bug that this PR has exposed. To explain - it looks like setting It's curious, it might be a bug that's been in |
|
Actually it is in the docs for contentOnly - "Unlike the other lock types, this is not overridable by children." I guess it's not a bug, but it means there's no way to properly lock accordion-item down if a parent sets contentOnly mode. TBH, these blocks are very complicated for contentOnly mode. In |
|
It looks like another related bug with the accordion block and locking:
Expected: all inner blocks are locked I think the root of the problem is the way Accordion is using |


What?
Adds support for the content insertion behavior introduced in #71232 for
templateLock: contentOnlyblocks.Why?
Brings some parity, also this is good to merge early in the 7.0 cycle to gather feedback from plugin users.
How?
canInsertBlockType,canMoveBlockTypeandcanRemoveBlockTypeselectors. These selectors all had clauses that would early returnfalsewhen any type of templateLock is in place. That condition is loosened to allowcontentOnlytemplateLock to fall through to the condition added in Allow adding "content" role blocks to containers that also have a "content" role in write mode #71232isSectionBlockselector. This one is probably a bug that hadn't been spotted yet.templateLockcascades down the hierarchy and is applied to all parent blocks. Because of this we don't want every templateLocked block to be considered a section, only top-level templateLocked block in the hierarchy. The reason this is needed is that without it, List Items and Nav Links were being considered 'sections' when in a templateLocked hierarchy, and that prevented a lot of the toolbar from being available.Testing Instructions
Screenshots or screencast