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

Wraps or rewrites finished block markup, which is what adding a schema script, a lazy-loading attribute or an analytics hook to every block takes.

It is the last filter in the render pipeline. The template has run, `` has been replaced with the real inner content, and the `useBlockProps` tag has already become a real wrapper carrying the block's classes, ID and alignment. What you receive is the exact string WordPress is about to print. Lazy Blocks Pro hooks this at priority 199 to collect styles for the block builder preview, and at priority 200 to cache editor renders for preloading, so a handler at the default priority 10 runs before both.

## Attributes

| Name               | Type               | Description                                                                            |
| ------------------ | ------------------ | -------------------------------------------------------------------------------------- |
| `$result`          | **String**         | finished block markup                                                                  |
| `$attributes`      | **Array**          | control values, as the template saw them                                               |
| `$render_location` | **String**         | `editor` or `frontend`                                                                 |
| `$block`           | **Array**          | block data, the same array [lzb/block_data](https://www.lazyblocks.com/docs/php-filters/lzb-block_data/) returns |
| `$context`         | **Array \| null**  | block context from parent blocks                                                       |
| `$content`         | **String \| null** | inner blocks markup before it was substituted                                          |

## Additional Filters

| Name                                   | Arguments                                                            | Description                         |
| -------------------------------------- | -------------------------------------------------------------------- | ----------------------------------- |
| `lazyblock/BLOCK_SLUG/frontend_output` | `$result, $attributes, $block, $context, $content`                   | specific block in the frontend only |
| `lazyblock/BLOCK_SLUG/editor_output`   | `$result, $attributes, $block, $context, $content`                   | specific block in the editor only   |
| `lazyblock/BLOCK_SLUG/output`          | `$result, $attributes, $render_location, $block, $context, $content` | specific block only                 |

The per-location variants take five arguments, with `$render_location` left out.

## Usage

```php title="PHP"
function my_lzb_block_render_output( $result, $attributes, $render_location, $block, $context, $content ) {
  // Append FAQ schema to the FAQ block on the front end only.
  if ( 'frontend' !== $render_location || 'lazyblock/faq' !== $block['slug'] ) {
    return $result;
  }

  $schema = array(
    '@context'   => 'https://schema.org',
    '@type'      => 'Question',
    'name'       => $attributes['question'],
    'acceptedAnswer' => array(
      '@type' => 'Answer',
      'text'  => wp_strip_all_tags( $attributes['answer'] ),
    ),
  );

  return $result . '<script type="application/ld+json">' . wp_json_encode( $schema ) . '</script>';
}

add_filter( 'lzb/block_render/output', 'my_lzb_block_render_output', 10, 6 );
```

Return a string. Returning `null` makes WordPress print nothing for the block, and returning an array raises a `TypeError` when the block content is concatenated. Because this runs after the wrapper is built, replacing the whole string throws away the block's generated classes, so keep the outer tag and modify around it.

To change the block's inputs instead of its output, use [lzb/block_render/attributes](https://www.lazyblocks.com/docs/php-filters/lzb-block_render-attributes/). To replace the render entirely, use [lzb/block_render/callback](https://www.lazyblocks.com/docs/php-filters/lzb-block_render-callback/).

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