Skip to content
PHP Filters

lzb/block_render/allow_inner_blocks_wrapper

Drops the <div> Lazy Blocks puts around inner blocks, which a block whose children have to be direct descendants of a grid or a flex container needs.

The default is true. With the wrapper on, the inner content is placed inside a <div> whose class is taken from a class or className attribute on the <InnerBlocks /> tag in your template, falling back to lazyblock-inner-blocks. With it off, the inner content replaces <InnerBlocks /> exactly where it stands and no element is added. The filter runs on the front end only, so the editor keeps its own wrapper and the two views differ until you account for that in your CSS.

Attributes

NameTypeDescription
$allow_inner_blocks_wrapperBooleanrender the wrapper, true by default
$attributesArraycontrol values, as the template saw them
$contextArray | nullblock context from parent blocks

The block itself is not passed. Read its slug from $attributes['lazyblock']['slug'], or use the per-block variant below.

Additional Filters

NameArgumentsDescription
lazyblock/BLOCK_SLUG/allow_inner_blocks_wrapper$allow_inner_blocks_wrapper, $attributes, $contextspecific block

Usage

PHP
function my_lzb_allow_inner_blocks_wrapper( $allow, $attributes, $context ) {
  // The columns block is a CSS grid, so its children have to be direct
  // descendants and the extra div would break the layout.
  if ( 'lazyblock/columns' === $attributes['lazyblock']['slug'] ) {
    return false;
  }
 
  return $allow;
}
 
add_filter( 'lzb/block_render/allow_inner_blocks_wrapper', 'my_lzb_allow_inner_blocks_wrapper', 10, 3 );
PHP
// Drop the wrapper for one block, without a callback.
add_filter( 'lazyblock/columns/allow_inner_blocks_wrapper', '__return_false' );

The return value is used as a boolean, so anything truthy keeps the wrapper. Turning it off for a block that has no inner content leaves <InnerBlocks /> replaced with an empty string rather than an empty <div>, which changes what a :empty or :first-child selector matches.

See Inner Blocks Wrapper for how the wrapper class is picked up from the template.

Was this article helpful?

Copyright © 2026 Lazy Blocks.