Support

Account

Home Forums Gutenberg get rid of “wp-block-acf-” prefix? Reply To: get rid of “wp-block-acf-” prefix?

  • Found a solution. There is a filter to allow an alternative class name:

    const setBlockCustomClassName = (className, blockName) => {
    	if (blockName === 'acf/my-custom-block') {
    	   return className + ' my-custom-block';
    	}
    	return className;
    };
    
    wp.hooks.addFilter(
    	'blocks.getBlockDefaultClassName',
    	'my-plugin/my-custom-block',
    	setBlockCustomClassName
    );