I’m trying this code to disable the left alignment option from the core/image
block. I just want to make available the center and right alignment options.
wp.hooks.addFilter(
'blocks.registerBlockType',
'elvismdev/my-theme',
function( settings, name ) {
if ( name === 'core/image' ) {
// Change supports
settings.supports = lodash.merge( {}, settings.supports, {
align: ['center', 'right']
});
}
return settings;
});
However, instead of doing what I’m expecting, it is adding a new alignment selector option to the block with only the center and right options, keeping the other default one with all of them (left, center, right).
Is blocks.registerBlockType
the right filter to do it, or I’m missing something else?