Gutenberg Configuration Example
Learn how to configure and customize the WordPress Gutenberg editor with the Combo plugin.
Basic Gutenberg Configuration
This example demonstrates how to configure the Gutenberg editor to match your project requirements:
1# Gutenberg configuration2gutenberg:3default-blocks: false #disable WordPress default blocks4allowed-blocks: false #or specify which blocks you want to authorize5default-css: false # remove default WordPress blocks css6fullscreen: false # disable Gutenberg fullscreen mode on first load78blocks-excerpt: # specify what fields can be used for excerpt9text:10- 'block_text_content'11textpicture:12- 'block_textpicture_content'1314categories: # define gutenberg block categories15- slug: 'text'16title: 'Texte'17icon: null1819- slug: 'media'20title: 'Médias'21icon: null2223- slug: 'hero'24title: 'Heros'25icon: null2627- slug: 'picture'28title: 'Images'29icon: null3031- slug: 'video'32title: 'Videos'33icon: null3435- slug: 'relation'36title: 'Relationnels'37icon: null3839- slug: 'other'40title: 'Autres'41icon: null
Configuration Options Explained
Core Settings
- default-blocks: When set to
false, disables all default WordPress blocks. Set totrueto keep them. - allowed-blocks: Controls which blocks are available to editors. Set to
falseto allow all blocks, or specify an array of block names to restrict available blocks. - default-css: When set to
false, removes WordPress default block CSS. This gives you more control over styling. - fullscreen: When set to
false, disables Gutenberg's fullscreen mode on initial load.
Excerpt Configuration
The blocks-excerpt setting allows you to specify which fields from which blocks can be used to generate post excerpts:
1blocks-excerpt:2text:3- 'block_text_content'4textpicture:5- 'block_textpicture_content'
In this example, the content from block_text_content field in text blocks and block_textpicture_content field in textpicture blocks will be used for generating excerpts.
Custom Block Categories
The categories setting allows you to define custom categories for organizing blocks in the editor:
1categories:2- slug: 'text'3title: 'Texte'4icon: null56- slug: 'media'7title: 'Médias'8icon: null
Each category requires a slug and title. The icon property is optional and can be set to a Dashicon name or left as null.
Specifying Allowed Blocks
If you want to restrict which blocks are available, you can specify them in the configuration:
1gutenberg:2default-blocks: false3allowed-blocks:4- 'core/paragraph'5- 'core/heading'6- 'core/image'7- 'core/list'8- 'core/quote'9- 'acf/testimonial'10- 'acf/team-member'11- 'acf/call-to-action'
This configuration allows only the specified core blocks and custom ACF blocks, restricting editors from using any other blocks.
Adding Custom Icons to Categories
You can add custom icons to your block categories using WordPress Dashicons:
1categories:2- slug: 'text'3title: 'Text'4icon: 'editor-textcolor'56- slug: 'media'7title: 'Media'8icon: 'format-image'910- slug: 'layout'11title: 'Layout'12icon: 'layout'
The icon property accepts any valid WordPress Dashicon name. You can find the complete list of available icons in the WordPress Dashicons reference.
Best Practices for Gutenberg Configuration
- Limit available blocks to only those needed for your specific content strategy
- Organize blocks into logical categories that make sense for your content editors
- Consider disabling default WordPress blocks and CSS if you're providing custom blocks with your own styling
- Use the excerpt configuration to ensure consistent excerpt generation from your custom blocks
- Test your configuration thoroughly with content editors to ensure a smooth editing experience