---
title: "lzb.editor.BlockEdit.attributesForRender"
description: "JS filter `lzb.editor.BlockEdit.attributesForRender` of the Lazy Blocks WordPress plugin."
url: "https://www.lazyblocks.com/docs/js-filters/lzb-editor-blockedit-attributesforrender/"
lastUpdated: 2026-08-26
source: "js-filters/lzb-editor-blockedit-attributesforrender.mdx"
---
# lzb.editor.BlockEdit.attributesForRender

Filters the attributes sent to the server when the editor renders a block preview.

By default the list holds the values of the registered controls plus a few reserved attributes. Use this filter to add an attribute your own code stores on the block but that is not registered as a control, so the preview can render with it.

## Attributes

| Name             | Type       | Description                                             |
| ---------------- | ---------- | ------------------------------------------------------- |
| `attsForRender`  | **Object** | attributes about to be sent for rendering                |
| `data`           | **Object** | `attributes`, `meta`, `lazyBlockData`, `props`           |

`data.attributes` holds every attribute on the block, including the ones left out of `attsForRender`.

## Usage

```js title="JS"
wp.hooks.addFilter(
  "lzb.editor.BlockEdit.attributesForRender",
  "my.custom.namespace",
  function (attsForRender, data) {
    if (data.lazyBlockData.slug !== "lazyblock/my-block") {
      return attsForRender;
    }

    return {
      ...attsForRender,
      myCustomAttribute: data.attributes.myCustomAttribute,
    };
  }
);
```

This affects the editor preview only. On the front end the block renders through PHP, where [lzb/block_render/attributes](https://www.lazyblocks.com/docs/php-filters/lzb-block_render-attributes/) does the same job.

## 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
