Skip to content
PHP Filters

lzb/register_block_type_data

Filters data for each block, that used when registering blocks using register_block_type function.

Attributes

NameTypeDescription
$dataArrayregistration data
$blockArrayblock data

Usage

PHP
function my_lzb_register_block_type_data( $data, $block ) {
  // Add custom style to block registration.
  if ( $block['slug'] === 'my-block' ) {
    $block['style'] = 'my-custom-style';
  }
 
  return $data;
}
 
add_filter( 'lzb/register_block_type_data', 'my_lzb_register_block_type_data', 10, 2 );

Was this article helpful?