Skip to content
PHP Filters

lzb_pro/rich_text/is_name_rendered

Tells Lazy Blocks Pro that a <RichText /> 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

NameTypeDescription
$is_renderedBooleanalways false, this is the fallback return of is_name_rendered()
$nameStringcomponent name being tested
$codeStringblock code with the <RichText /> tags removed

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

PatternMatches
{{ ... 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
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 returns.

Was this article helpful?

Copyright © 2026 Lazy Blocks.