PHP Filters
lzb/block_render/attributes
Filters block attribute before render block output.
Attributes
Name | Type | Description |
---|---|---|
$attributes | Array | block attributes |
$content | String | block content |
$block | Array | block data |
$context | String | rendering context [editor , frontend ] |
Additional Filters
Name | Description |
---|---|
lazyblock/BLOCK_SLUG/frontend_attributes | specific block in the frontend only |
lazyblock/BLOCK_SLUG/editor_attributes | specific block in the editor only |
lazyblock/BLOCK_SLUG/attributes | specific block only |
Usage
PHP
function my_lzb_block_render_attributes( $attributes, $content, $block, $context ) {
// Change value of custom attribute "my-attribute"
$attributes['my-attribute'] = 'custom attribute value';
return $attributes;
}
add_filter( 'lzb/block_render/attributes', 'my_lzb_block_render_attributes', 10, 4 );
PHP
function my_lzb_block_render_attributes( $attributes, $content, $block, $context ) {
// Change value of custom attribute "my-attribute" for block "lazyblock/my-custom-block"
$attributes['my-attribute'] = 'custom attribute value';
return $attributes;
}
add_filter( 'lazyblock/my-custom-block/attributes', 'my_lzb_block_render_attributes', 10, 4 );