---
title: "lzb_pro/rich_text/is_name_rendered"
description: "PHP filter `lzb_pro/rich_text/is_name_rendered` of the Lazy Blocks Pro WordPress plugin."
url: "https://www.lazyblocks.com/docs/php-filters/lzb_pro-rich_text-is_name_rendered/"
source: "php-filters/lzb_pro-rich_text-is_name_rendered.mdx"
---
# lzb_pro/rich_text/is_name_rendered [Pro]

Tells Lazy Blocks Pro that a `` value is printed a second time somewhere in the block code, in a form the built-in patterns do not recognise.

When the component is the only thing rendering a value, the editor updates the text on the client and never asks the server. When the value is also printed elsewhere, say in a `title` attribute or a data attribute, skipping the server render leaves that second copy stale. Lazy Blocks Pro works this out by pattern matching, and this filter is where a block with its own way of reading values corrects the result.

## Attributes

| Name           | Type        | Description                                                         |
| -------------- | ----------- | ------------------------------------------------------------------- |
| `$is_rendered` | **Boolean** | always `false`, this is the fallback return of `is_name_rendered()` |
| `$name`        | **String**  | component name being tested                                         |
| `$code`        | **String**  | block code with the `` tags removed                     |

Two patterns run before the filter, and a match on either returns `true` without ever reaching a handler:

| Pattern                                      | Matches                                                                  |
| -------------------------------------------- | ------------------------------------------------------------------------ |
| `{{ ... name ... }}`                         | `{{my-title}}`, `{{{my-title}}}`, `{{#if my-title}}`, `{{my-title.sub}}` |
| `$attributes['name']` and `$context['name']` | the PHP output method reading the value directly                         |

A handler can therefore only turn a `false` into a `true`. There is no way to cancel a match the built-in patterns already made.

## Usage

```php title="PHP"
function my_lzb_pro_rich_text_is_name_rendered( $is_rendered, $name, $code ) {
  // Our PHP blocks read values through a helper rather than $attributes[],
  // which is why the built-in pattern misses them.
  $pattern = '/acme_field\(\s*[\'"]' . preg_quote( $name, '/' ) . '[\'"]\s*\)/';

  return (bool) preg_match( $pattern, $code );
}

add_filter( 'lzb_pro/rich_text/is_name_rendered', 'my_lzb_pro_rich_text_is_name_rendered', 10, 3 );
```

Returning `true` takes the name out of the exclusive set, and the editor then refetches the server preview on every keystroke in that field. Returning `false`, the default, leaves editing on the client and risks a second copy of the value going stale in the preview until the block is reselected. The result is cached per block for the request, so a handler runs once per name and not once per render.

Which names end up exclusive is decided from the list [lzb_pro/rich_text/names](https://www.lazyblocks.com/docs/php-filters/lzb_pro-rich_text-names/) returns.

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