---
title: "lzb/block_render/allow_wrapper"
description: "PHP filter `lzb/block_render/allow_wrapper` of the Lazy Blocks WordPress plugin."
url: "https://www.lazyblocks.com/docs/php-filters/lzb-block_render-allow_wrapper/"
lastUpdated: 2026-09-09
source: "php-filters/lzb-block_render-allow_wrapper.mdx"
---
# lzb/block_render/allow_wrapper

Stops Lazy Blocks adding its own outer `<div>` to a block whose template already opens with the element it wants.

  This filter is **deprecated** since v4.0.0. It still runs, and WordPress logs
  a deprecation notice when it does. Add the wrapper attributes with
  [useBlockProps](https://www.lazyblocks.com/docs/blocks-code/use-block-props/) instead.

Returning `false` only skips the automatic `<div useBlockProps>`. It has no effect at all on a template that already carries a `useBlockProps` attribute on one of its own tags, because Lazy Blocks adds the wrapper only when it cannot find one. Marking your own outer tag with `useBlockProps` does the same job without the deprecation notice, and keeps the block's classes, anchor and alignment on an element you control. The filter runs on the front end only.

## Attributes

| Name               | Type        | Description                              |
| ------------------ | ----------- | ---------------------------------------- |
| `$allow_wrapper`   | **Boolean** | render the wrapper, `true` by default    |
| `$attributes`      | **Array**   | control values, as the template saw them |
| `$render_location` | **String**  | always `frontend`                        |

## Additional Filters

| Name                                          | Arguments                                       | Description                         |
| --------------------------------------------- | ----------------------------------------------- | ----------------------------------- |
| `lazyblock/BLOCK_SLUG/frontend_allow_wrapper` | `$allow_wrapper, $attributes`                   | specific block in the frontend only |
| `lazyblock/BLOCK_SLUG/allow_wrapper`          | `$allow_wrapper, $attributes, $render_location` | specific block only                 |

Both variants are deprecated on the same terms as the main filter, and each logs its own notice.

## Usage

```php title="PHP"
function my_lzb_block_render_allow_wrapper( $allow_wrapper, $attributes, $render_location ) {
  // The table block renders a <table> and cannot sit inside a div.
  if ( 'lazyblock/data-table' === $attributes['lazyblock']['slug'] ) {
    return false;
  }

  return $allow_wrapper;
}

add_filter( 'lzb/block_render/allow_wrapper', 'my_lzb_block_render_allow_wrapper', 10, 3 );
```

```php title="PHP"
// Drop the wrapper for one block on the front end.
add_filter( 'lazyblock/data-table/frontend_allow_wrapper', '__return_false' );
```

Dropping the wrapper without marking a tag `useBlockProps` also drops the block's generated classes, its anchor ID and its alignment class, because those are only applied to the `useBlockProps` element. That is the reason the replacement exists.

See [Block Wrapper](https://www.lazyblocks.com/docs/blocks-code/php-callback/#block-wrapper) for what the wrapper contains.

## Documentation Index
> Fetch the complete documentation index at: https://www.lazyblocks.com/llms.txt
> Fetch every page in a single file at: https://www.lazyblocks.com/llms-full.txt
