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

Changes what `get_lzb_meta()` hands back to a theme file, which is where a fallback value or a formatted version belongs when the same meta is read from a dozen templates.

It fires on the way out of `get_lzb_meta()`, after the value has been read from post meta and after [lzb/control_value](https://www.lazyblocks.com/docs/php-filters/lzb-control_value/) has converted it for its control type. Inside the block editor preview the value comes from the block being previewed rather than from the database, and this filter still runs, so a fallback added here shows up in the preview too.

## Attributes

| Name            | Type              | Description                                                       |
| --------------- | ----------------- | ----------------------------------------------------------------- |
| `$result`       | **Mixed**         | value returned by `get_lzb_meta()`                                |
| `$name`         | **String**        | meta name asked for                                               |
| `$id`           | **Int \| null**   | post ID, `null` when no ID was passed and there is no global post |
| `$control_data` | **Array \| null** | the control that saves this meta, `null` when no control does     |

`$control_data` is found by walking every block's controls for one whose **Save in Meta** is on and whose meta name matches. A meta name that no control owns still reaches this filter, with `$control_data` as `null` and `$result` straight from `get_post_meta()`.

## Usage

```php title="PHP"
function my_lzb_get_meta( $result, $name, $id, $control_data ) {
  // Fall back to the site name for the page subtitle, so templates do not
  // each need their own empty check.
  if ( 'page-subtitle' !== $name || ! empty( $result ) ) {
    return $result;
  }

  return get_bloginfo( 'name' );
}

add_filter( 'lzb/get_meta', 'my_lzb_get_meta', 10, 4 );
```

Guard on `$name`, as above. The filter fires for every meta name Lazy Blocks is asked for, so a handler that changes `$result` unconditionally rewrites unrelated fields. Return the type the control saves. A Repeater's value is an array and a template that iterates it breaks on a string.

To change the value for every use rather than only for `get_lzb_meta()`, hook [lzb/control_value](https://www.lazyblocks.com/docs/php-filters/lzb-control_value/) instead. Reading meta from templates is covered in [Display custom fields meta](https://www.lazyblocks.com/docs/examples/display-custom-fields-meta/).

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