Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Render_block_filter.php
function test_filter( $block_content, $block ) {
if ( empty( trim( $block_content ) ) ) {
return $block_content;
}
if ( $block['blockName'] == 'core/paragraph' ) {
return sprintf(
'<section class="block-%1$s">%2$s</section>',
sanitize_title( $block['blockName'] ),
$block_content
);
}
return $block_content;
}
add_filter( 'render_block', 'test_filter', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.