Settings
Blockstudio includes a powerful settings API, that allows setting options via a blockstudio.json file inside your theme folder and/or filters. Additionally, allowed users are able to change the settings visually inside the admin area.
Via JSON
If a blockstudio.json file is present inside your theme folder, it will be used to set the default options for the current site. A JSON schema is available to validate the file and help with autocompletion when used in an IDE.
The following properties are available:
{
"$schema": "https://blockstudio.dev/schema/blockstudio",
"users": {
"ids": [],
"roles": []
},
"assets": {
"enqueue": true,
"minify": {
"css": false,
"js": false
},
"process": {
"scss": false
}
},
"editor": {
"formatOnSave": false,
"assets": [],
"markup": false
},
"ui": {
"enabled": false
},
"library": false,
"blockEditor": {
"disableLoading": false,
"enhance": false,
"cssClasses": [],
"cssVariables": [],
"blocks": {
"allow": [],
"deny": [],
"directory": true,
"categories": {
"allow": [],
"deny": [],
"rename": {},
"order": []
},
"styles": {
"deny": {}
},
"legacyWidgets": {
"hide": []
}
},
"patterns": {
"core": true,
"remote": true,
"theme": true,
"blockstudio": true,
"categories": {
"allow": [],
"deny": [],
"rename": {},
"order": []
}
},
"media": {
"openverse": true,
"imageSizes": {
"allow": [],
"deny": []
}
}
}
}Via Filters
Alternatively you can use the blockstudio/settings/${setting} filter to set options via PHP for more flexibility.
add_filter('blockstudio/settings/assets/enqueue', '__return_false');
add_filter('blockstudio/settings/editor/formatOnSave', '__return_true');
add_filter('blockstudio/settings/ui/enabled', '__return_true');
add_filter('blockstudio/settings/block_editor/patterns/remote', '__return_false');Options set via the blockstudio/settings/${setting} filter will override the ones set via the blockstudio.json file. Both methods can be used together.
Available Settings
users
| Option | Type | Default | Description |
|---|---|---|---|
ids | array | [] | User IDs with editor access |
roles | array | [] | User roles with editor access |
assets
| Option | Type | Default | Description |
|---|---|---|---|
enqueue | boolean | true | Auto-enqueue block assets |
minify.css | boolean | false | Minify CSS output |
minify.js | boolean | false | Minify JS output |
process.scss | boolean | false | Process SCSS files |
editor
| Option | Type | Default | Description |
|---|---|---|---|
formatOnSave | boolean | false | Format block.json on save |
assets | array | [] | Additional assets to load in editor |
markup | boolean | false | Enable markup editing |
library
| Type | Default | Description |
|---|---|---|
| boolean | false | Enable the block library |
tailwind
| Option | Type | Default | Description |
|---|---|---|---|
enabled | boolean | false | Enable Tailwind CSS compilation |
config | string | "" | Tailwind v4 CSS-first configuration |
ui
| Option | Type | Default | Description |
|---|---|---|---|
enabled | boolean | false | Register the bundled bsui/* UI components and app/* demo apps |
blockEditor
| Option | Type | Default | Description |
|---|---|---|---|
disableLoading | boolean | false | Disable block loading in editor |
enhance | boolean | false | Enable Blockstudio editor hover and selection affordances |
cssClasses | array | [] | Stylesheet URLs to extract CSS classes from for the classes field autocomplete |
cssVariables | array | [] | Stylesheet URLs to extract CSS variables from for the code field autocomplete |
blockEditor.blocks
Use blockEditor.blocks for project-wide block inserter policy. allow and deny accept block names and wildcard patterns such as core/*.
{
"blockEditor": {
"blocks": {
"allow": ["core/*", "my-theme/*"],
"deny": ["core/embed", "core/freeform"],
"directory": false,
"categories": {
"rename": {
"text": "Writing",
"design": "Layout"
},
"order": ["my-theme", "text", "media"]
},
"legacyWidgets": {
"hide": ["archives", "calendar"]
}
}
}
}blocks.styles.deny unregisters styles that were registered through WordPress'
PHP block style registry:
{
"blockEditor": {
"blocks": {
"styles": {
"deny": {
"my-theme/card": ["outline"],
"my-theme/media": ["framed"]
}
}
}
}
}blockEditor.patterns
Use blockEditor.patterns to disable global pattern sources and to filter
pattern categories.
{
"blockEditor": {
"patterns": {
"core": false,
"remote": false,
"theme": true,
"blockstudio": true,
"categories": {
"deny": ["gallery"],
"rename": {
"featured": "Featured Layouts"
},
"order": ["featured", "buttons"]
}
}
}
}blockEditor.media
Use blockEditor.media for global media inserter policy.
{
"blockEditor": {
"media": {
"openverse": false,
"imageSizes": {
"allow": ["thumbnail", "large"],
"deny": ["medium_large"]
}
}
}
}