Skip to content

Add option to block API to only allow root level insertion #42548

@fabiankaegy

Description

@fabiankaegy

What problem does this address?

There are instances where a block should only ever exist at the root level of the block editor. It should never be nested within a Group or any other InnerBlocks area. Examples of this are things like the Page Header Template Part. Also when building custom blocks this is something that comes up here and there.
Often this is best paired with the supports.multiple option set to false so an editor can only insert the block once at the root level

What is your proposed solution?

Add a new Block Supports option that is essentially the opposite of ancestor or parent. Maybe it could even use the parent key just set to false.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Developer ExperienceIdeas about improving block and theme developer experience[Feature] Block APIAPI that allows to express the block paradigm.[Feature] Nested / Inner BlocksAnything related to the experience of nested/inner blocks inside a larger container, like Group or P[Type] EnhancementA suggestion for improvement.[Type] New APINew API to be used by plugin developers or package users.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions