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

Filters the block attributes handed to WPML for translation.

Lazy Blocks builds this list from the controls whose **Translate** setting is on. Use the filter to add an attribute your own code stores on the block, which has no control behind it and so would never reach WPML on its own.

## Attributes

| Name                   | Type      | Description                             |
| ---------------------- | --------- | --------------------------------------- |
| `$translated_controls` | **Array** | WPML config nodes for this block         |
| `$block`               | **Array** | block data                               |

Each item is a WPML config node rather than a plain attribute name. A single attribute looks like this:

```php title="PHP"
array(
  'value' => '',
  'attr'  => array(
    'name' => 'my-attribute',
  ),
)
```

An attribute holding a JSON array, the shape a Repeater control produces, nests its inner attributes under a `*` key:

```php title="PHP"
array(
  'value' => '',
  'attr'  => array(
    'name'     => 'my-repeater',
    'encoding' => 'json',
  ),
  'key'   => array(
    'value' => '',
    'attr'  => array(
      'name' => '*',
    ),
    'key'   => array(
      array(
        'value' => '',
        'attr'  => array( 'name' => 'inner-attribute' ),
      ),
    ),
  ),
)
```

## Usage

```php title="PHP"
function my_lzb_wpml_translated_attributes( $translated_controls, $block ) {
  if ( 'my-block' !== $block['slug'] ) {
    return $translated_controls;
  }

  $translated_controls[] = array(
    'value' => '',
    'attr'  => array(
      'name' => 'my-attribute',
    ),
  );

  return $translated_controls;
}

add_filter( 'lzb/wpml/translated_attributes', 'my_lzb_wpml_translated_attributes', 10, 2 );
```

Returning an empty array keeps the block out of the generated WPML configuration entirely.

See [Multilingual](https://www.lazyblocks.com/docs/multilingual/) for how Lazy Blocks and WPML work together.

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