Skip to content
PHP Filters

lzb_pro/rich_text/textual_control_types

Lists the control types <RichText /> is allowed to take over.

A control's registered type is not enough to decide this. Image, Gallery and Repeater are all registered as string because they store JSON, and letting the component print one of those would dump the raw JSON on the page. Lazy Blocks Pro keeps an explicit list instead, and a custom control that stores a plain string has to be added to it.

Attributes

NameTypeDescription
$typesArraycontrol types the component may bind to

The default list is text, textarea, rich_text, classic_editor, code_editor, url and email.

The filter fires at two points, and both have to agree:

WhereWhat it decides
enqueue_block_editor_assetsthe textualControlTypes list handed to the editor script, which decides whether the component renders as an editable field or as a plain fallback with a console warning
is_textual_control()whether the front end prints the value or returns an empty string for that tag

Usage

PHP
function my_lzb_pro_rich_text_textual_control_types( $types ) {
  // Custom control storing a plain string, so the component can edit it
  // inline the same way it edits a Text control.
  $types[] = 'acme_heading';
 
  return $types;
}
 
add_filter( 'lzb_pro/rich_text/textual_control_types', 'my_lzb_pro_rich_text_textual_control_types' );

A <RichText /> bound to a control whose type is not on the list renders as an empty string on the front end. Adding a type that stores JSON does not fix the JSON, it prints it: the value is escaped with esc_html() and the reader sees the serialised array in the page.

Whether the value is treated as markup is a separate decision, made from a constant with no filter behind it. Only rich_text and classic_editor keep their HTML through wp_kses_post(). Every other type on this list, including one you add, is escaped with esc_html(), so formatting typed into it comes out as visible tags.

The editor list is localised while enqueue_block_editor_assets runs, so a filter registered later than that changes the front end only, and the editor goes on offering a field the front end then refuses to print. The component itself is covered in Rich Text.

Was this article helpful?

Copyright © 2026 Lazy Blocks.