PHP Filters
lzb/block_render/allow_wrapper
Filter for standard block wrapper <div>
, which contains block classes, IDs, and attributes.
See additional info here – https://www.lazyblocks.com/docs/blocks-code/php-callback/#frontend-output-wrapper
Attributes
Name | Type | Description |
---|---|---|
$allow_wrapper | Boolean | allow wrapper rendering |
$attributes | Array | block attributes |
$context | String | rendering context [editor , frontend ] |
Additional Filters
Name | Description |
---|---|
lazyblock/BLOCK_SLUG/frontend_allow_wrapper | specific block in the frontend only |
lazyblock/BLOCK_SLUG/editor_allow_wrapper | specific block in the editor only |
lazyblock/BLOCK_SLUG/allow_wrapper | specific block only |
Usage
PHP
function my_lzb_block_render_allow_wrapper( $allow_wrapper, $attributes, $context ) {
// Disable block output if there is a custom attribute "my-attribute"
if ( isset( $attributes['my-attribute'] ) && $attributes['my-attribute'] ) {
return false;
}
return $allow_wrapper;
}
add_filter( 'lzb/block_render/allow_wrapper', 'my_lzb_block_render_allow_wrapper', 10, 3 );
PHP
function my_lzb_block_render_allow_wrapper( $allow_wrapper, $attributes, $context ) {
// Disable block output for block "lazyblock/my-custom-block"
return false;
}
add_filter( 'lazyblock/my-custom-block/allow_wrapper', 'my_lzb_block_render_allow_wrapper', 10, 3 );
PHP
// Disable block frontend wrapper for all blocks.
add_filter( 'lzb/block_render/frontend_allow_wrapper', '__return_false' );