Skip to content
PHP Filters

lzb/block_render/callback

Custom output callback for the block. See additional info on this article.

Attributes

NameTypeDescription
$resultStringblock output
$attributesArrayblock attributes
$contextStringrendering context [editor, frontend]

Additional Filters

NameDescription
lazyblock/BLOCK_SLUG/frontend_callbackspecific block in the frontend only
lazyblock/BLOCK_SLUG/editor_callbackspecific block in the editor only
lazyblock/BLOCK_SLUG/callbackspecific block only

Usage

PHP
function my_lzb_block_render_callback( $result, $attributes, $context ) {
  // Custom output for all blocks
  return '<p>Custom Paragraph</p>';
}
 
add_filter( 'lzb/block_render/callback', 'my_lzb_block_render_callback', 10, 3 );
PHP
function my_lzb_block_render_callback( $result, $attributes, $context ) {
  // Custom output for block "lazyblock/my-custom-block"
  return '<p>Custom Paragraph</p>';
}
 
add_filter( 'lazyblock/my-custom-block/callback', 'my_lzb_block_render_callback', 10, 3 );

Was this article helpful?