Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
WC Lancaster filter to show block type if you have WP_DEBUG turned on.
<?php
add_filter( 'render_block', 'wplancpa_2019_show_block_type', 10, 2 );
function wplancpa_2019_show_block_type( $block_content, $block ) {
if ( true === WP_DEBUG ) {
$block_content = "<h5 style=\"color:salmon\">{$block['blockName']}</h5><div class='wp-block' data-blockType='{$block['blockName']}'>{$block_content}</div>";
}
return $block_content;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment