Skip to content

Clarify block name immutability and namespace best practices [docs]#71040

Merged
Mamaduka merged 1 commit intoWordPress:trunkfrom
dhananjaykuber:docs/update-block-registration-namespace-for-clearity
Aug 5, 2025
Merged

Clarify block name immutability and namespace best practices [docs]#71040
Mamaduka merged 1 commit intoWordPress:trunkfrom
dhananjaykuber:docs/update-block-registration-namespace-for-clearity

Conversation

@dhananjaykuber
Copy link
Copy Markdown
Contributor

Closes #71022

What?

Updates the Block Name documentation to clarify that block names are immutable and provides improved guidance on namespace selection.

Why?

The current documentation doesn't emphasize that block names cannot be changed after deployment, which can lead to serious issues for developers who need to rename blocks later. Block names are stored in post content as HTML comments, making changes require manual post editing or database scripts. Additionally, many developers use generic namespaces like create-block/* without understanding the long-term implications.

How?

  • Added a prominent warning that block names cannot be changed later
  • Explained the technical reason (stored in post content) and consequences
  • Provided clear examples of good vs bad namespace choices
  • Added guidance to avoid generic namespaces and use plugin/theme-specific names
  • Noted the registerBlockCollection() limitation to single namespaces

@github-actions
Copy link
Copy Markdown

github-actions bot commented Aug 4, 2025

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 props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: dhananjaykuber <dhananjaykuber@git.wordpress.org>
Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>
Co-authored-by: Sahil1617 <sahiljadhav1617@git.wordpress.org>
Co-authored-by: acketon <acketon@git.wordpress.org>

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

@Mamaduka Mamaduka added [Feature] Block API API that allows to express the block paradigm. [Type] Developer Documentation Documentation for developers labels Aug 4, 2025
Copy link
Copy Markdown
Member

@Mamaduka Mamaduka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @dhananjaykuber!

@Mamaduka Mamaduka added the props-bot Manually triggers Props Bot to ensure the list of props is up to date. label Aug 5, 2025
@github-actions github-actions bot removed the props-bot Manually triggers Props Bot to ensure the list of props is up to date. label Aug 5, 2025
@Mamaduka Mamaduka merged commit e19692e into WordPress:trunk Aug 5, 2025
69 of 73 checks passed
@github-actions github-actions bot added this to the Gutenberg 21.4 milestone Aug 5, 2025
@acketon
Copy link
Copy Markdown

acketon commented Aug 5, 2025

Thanks @dhananjaykuber this looks great.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Feature] Block API API that allows to express the block paradigm. [Type] Developer Documentation Documentation for developers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve Documentation for Block Registration: namespace in Block Name

3 participants