How to get “Additional CSS Class” for ACF Gutenberg block

Note that I don’t have ACF PRO 5.8 which comes with the Block features, but I hope this answer helps.

If you look at the example here, you can retrieve the additional/custom CSS classes using props.attributes.className; i.e. the classes are saved as an attribute named className.

So with that in mind and based on acf_register_block() (which as of writing, it redirects to acf_register_block_type()), your render_callback function would receive a $block array (the block settings and attributes) as the first argument, and therefore you should be able to retrieve the additional CSS class(es) via $block['className'] as shown here — see the example under “Registering a block with callback“.

Leave a Comment