Skip to content

Instantly share code, notes, and snippets.

@mizner
Created February 6, 2019 08:39
Show Gist options
  • Save mizner/719635d726d14746f6425fab6a2de0c3 to your computer and use it in GitHub Desktop.
Save mizner/719635d726d14746f6425fab6a2de0c3 to your computer and use it in GitHub Desktop.
Filter WordPress Gutenberg Block Output
<?php
add_filter('render_block', function ($block_content, $block) {
// Remove the block/timed-block from the rendered content.
if ('core/paragraph' === $block['blockName']) {
$block_content = "<div class='wp-block' data-blockType='{$block['blockName']}'>{$block_content}</div>";
}
return $block_content;
}, 10, 2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment