I use a block filter to add classes to core and custom blocks. It doesn't work with dynamic blocks though. I tested with my custom block, and then tried with the core latest posts block and it didn't work either. Is it not possible to use block filters to add classes to dynamic blocks?
I'm using the blocks.getSaveContent.extraProps
filter, which adds a class to the block on the frontend. My php template for the dynamic block uses this as the outer wrapper, which pulls in alignment and color classes, just not block filter classes:
<div <?php echo wp_kses_data( get_block_wrapper_attributes() ); ?>> inner block stuff</div>
core/group
block. I found out that is also possible to modify the core block using the following filterregister_block_type_args
.