Skip to content

Instantly share code, notes, and snippets.

@pbrocks
Created May 24, 2019 19:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pbrocks/8086031677e2eaa5f94093f9667855c4 to your computer and use it in GitHub Desktop.
Save pbrocks/8086031677e2eaa5f94093f9667855c4 to your computer and use it in GitHub Desktop.
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