I want to add some custom styles to the Gutenberg group block. Unfortunately the normal way doesn't work.
Here's my code for that (works for heading and other blocks):
wp.blocks.registerBlockStyle( 'core/group', {
name: 'container',
label: 'Container',
} );
Is there no option to add custom styles to this block? I saw that you can add custom colors and custom styles in the admin. So I don't understand why this wouldn't be possible.
I can't remember why my code didn't work. But now it does. Here's the full working code:
wp.domReady( () => {
wp.blocks.registerBlockStyle(
'core/group',
[
{
name: 'container',
label: 'Container',
}
]
);
} );
I guess the code was already correct and I haven't included it in the right way.