Default alignfull on Group and Cover causes block validation error
-
I’m using the following code to default my Groups and Covers to be alignfull.
wp.hooks.addFilter( 'blocks.registerBlockType', 'bdc/wordexpresso', function( settings, name ) { if ( name === 'core/cover' || name === 'core/group' ) { return lodash.assign( {}, settings, { attributes: lodash.assign( {}, settings.attributes, { align: { type: 'string', default: 'full' } } ), } ); } return settings; } );
And it does work, but it’s causing a JS error in the console on page load that I would like to ideally have go away. Even if it is functional code, I don’t like the idea of having console errors.
Block validation: Expected attribute
class
of valuewp-block-cover alignfull has-custom-content-position is-position-top-left has-background-color has-text-color
, sawwp-block-cover has-custom-content-position is-position-top-left has-background-color has-text-color
.I tried setting the default Class along with this hook, but that didn’t work. It’s not clear what I need to do to properly change the default alignment on Groups and Covers.
- The topic ‘Default alignfull on Group and Cover causes block validation error’ is closed to new replies.