You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Allow blocks to be renamed via a block template #77436
It would be incredibly helpful if custom names could be applied to blocks within a block template as well. For instance, we're creating a top level container block that exists on every page. At the start of that container, I would like a Spacer block renamed to "Space Below Header" and one at the end of that container called "Space Above Footer". Best I can tell, this is not currently possible.
What is your proposed solution?
Add block renaming support to the block template array. Maybe something like:
@t-hamano I did not realize the method you described was possible! I will give that a go.
@Mamaduka I'm not sure I follow your suggestion. I have looked for more documentation on block templates and it seems fairly spotty (at least from what I've been able to find, which is all very basic). If what I described is possible now without having to write the full markup of the block as @t-hamano suggests, I'd love more details on that.
Ok, with y'all's help I have figured this out! @Mamaduka I did look at that documentation prior to trying to alter the block name in my template, but I was simply using the incorrect array key (or, more specifically, I was not going deep enough). I didn't initially understand your comment to mean that I was not using the correct property.
@t-hamano your example made me realize I was not properly using the metadata key.
I agree that this is primarily a documentation issue. It's not always clear exactly how to set a lot of these properties. In retrospect, I should have created the block in the editor and then looked at the relevant JSON object metadata to determine the proper keys, but it would be nice if that weren't necessary.
Activity
t-hamano commentedon Apr 17, 2026
If I understand correctly, can't we apply a custom name like this?
Mamaduka commentedon Apr 17, 2026
It should be possible today, just requires setting up the
metadata.nameargument.eric-michel commentedon Apr 17, 2026
@t-hamano I did not realize the method you described was possible! I will give that a go.
@Mamaduka I'm not sure I follow your suggestion. I have looked for more documentation on block templates and it seems fairly spotty (at least from what I've been able to find, which is all very basic). If what I described is possible now without having to write the full markup of the block as @t-hamano suggests, I'd love more details on that.
t-hamano commentedon Apr 18, 2026
I believe this issue relates to documentation improvements rather than feature enhancements or bugs.
Mamaduka commentedon Apr 20, 2026
@eric-michel, I was referring to post type templates, which can be defined as a PHP array - https://developer.wordpress.org/block-editor/reference-guides/block-api/block-templates/. Based on your example in the description, I thought you were using that.
eric-michel commentedon Apr 21, 2026
Ok, with y'all's help I have figured this out! @Mamaduka I did look at that documentation prior to trying to alter the block name in my template, but I was simply using the incorrect array key (or, more specifically, I was not going deep enough). I didn't initially understand your comment to mean that I was not using the correct property.
@t-hamano your example made me realize I was not properly using the
metadatakey.This is what I originally tried:
Instead, it should have been:
I agree that this is primarily a documentation issue. It's not always clear exactly how to set a lot of these properties. In retrospect, I should have created the block in the editor and then looked at the relevant JSON object metadata to determine the proper keys, but it would be nice if that weren't necessary.
I'll close this issue. Thank you both!