Skip to content
PHP Filters

lzb/controls/all

Registers a control type, or changes one that already exists, which is the single place the block builder's control list comes from.

The default value is an empty array. Every built-in control adds itself here from its own class, keyed by its type slug, on lzb/init at priority 5. Nothing else builds the list, so a handler that returns something other than the array it was given removes every control from the block builder and drops every control from every block, because prepare_block_controls() silently discards a control whose type it cannot find.

Attributes

NameTypeDescription
$controlsArraycontrol definitions, keyed by control type slug

Each entry holds these keys:

KeyTypeDescription
nameStringtype slug, the same as the array key
iconStringSVG markup shown in the control picker
typeStringattribute type, one of string, number, boolean, array, object
labelStringcontrol name shown in the block builder
categoryStringgrouping in the control picker, see lzb/controls/categories
restrictionsArraywhich settings the block builder offers for this control
attributesArraydefaults merged into every control of this type

Usage

PHP
function my_lzb_controls_all( $controls ) {
  // Keep the Code Editor control out of the block builder for everyone
  // who cannot edit files, and move Number next to Text.
  if ( ! current_user_can( 'edit_themes' ) ) {
    unset( $controls['code_editor'] );
  }
 
  if ( isset( $controls['number'] ) ) {
    $controls['number']['category'] = 'basic';
  }
 
  return $controls;
}
 
add_filter( 'lzb/controls/all', 'my_lzb_controls_all', 11 );

Use priority 11 or later. The built-in controls register at the default priority 10, so a handler at 10 or below sees a list that is still being filled. Removing a type that blocks already use makes those controls vanish from the blocks as well, not only from the picker, and the attributes behind them stop being registered.

Adding a control type of your own is covered in Create Custom Control, which subclasses LazyBlocks_Control and lets the base class hook this filter for you.

Was this article helpful?

Copyright © 2026 Lazy Blocks.