Description
When I register a custom container block with templateLock set to contentOnly, WordPress treats it as a pattern.
The “Edit pattern” button appears in both the block toolbar and the Inspector.
I believe this may be related to how contentOnly mode interacts with the new unsynced patterns in WordPress 7.0.
Step-by-step reproduction instructions
The code to register a test content-only container block:
import { registerBlockType } from "@wordpress/blocks";
import { useBlockProps, useInnerBlocksProps } from "@wordpress/block-editor";
/**
* Register the block type.
* 'test/content-locked-container'
*/
registerBlockType("test/content-locked-container", {
title: "Content-Only Container",
category: "layout",
edit: () => {
const MY_TEMPLATE = [
["core/heading", { level: 3, placeholder: "Editable Heading" }],
[
"core/paragraph",
{
placeholder:
"This text can be edited, but the block cannot be moved.",
},
],
];
const blockProps = useBlockProps();
const innerBlocksProps = useInnerBlocksProps(blockProps, {
template: MY_TEMPLATE,
templateLock: "contentOnly",
});
return <div {...innerBlocksProps} />;
},
save: () => {
const blockProps = useBlockProps.save();
const innerBlocksProps = useInnerBlocksProps.save(blockProps);
return <div {...innerBlocksProps} />;
},
});
Screenshots, screen recording, code snippet
No response
Environment info
- WordPress version 7.0 beta 6, 2025 theme
Please confirm that you have searched existing issues in the repo.
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Please confirm which theme type you used for testing.
Description
When I register a custom container block with templateLock set to contentOnly, WordPress treats it as a pattern.
The “Edit pattern” button appears in both the block toolbar and the Inspector.
I believe this may be related to how contentOnly mode interacts with the new unsynced patterns in WordPress 7.0.
Step-by-step reproduction instructions
The code to register a test content-only container block:
Screenshots, screen recording, code snippet
No response
Environment info
Please confirm that you have searched existing issues in the repo.
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Please confirm which theme type you used for testing.