Block Manifest
This file contains all the configuration required for a block to work. It's used in WordPress registerBlockType
method to register a block. Using manifest.json
, we can provide a configuration in JavaScript and PHP part of the block in one file.
Example
{
"namespace": "custom-namespace",
"blockName": "heading",
"title": "Heading",
"description": "Heading block with custom settings.",
"category": "common",
"icon": {
"background": "#900",
"foreground": "#500",
"src": "heading"
},
"keywords": [
"Header",
"Title"
],
"example": {
"attributes": {
"content": "New content",
"level": 2
}
},
"attributes": {
"content": {
"type": "string"
},
"level": {
"type": "integer",
"default": 2
}
},
"hasInnerBlocks": false,
"components": {},
"responsiveAttributes": {},
"variables": {},
"options": {}
}
Most of the keys are the same as in the block.json metadata. If you can't find the description here, please check the official documentation. We also have some custom features here, not present in the block.json
file:
namespace
custom feature
The block's namespace is set globally in the global manifest for all your custom blocks, but you can override them on each block if you need to.