---
title: "lzb.constructor.general-settings.keywords"
description: "JS filter `lzb.constructor.general-settings.keywords` of the Lazy Blocks WordPress plugin."
url: "https://www.lazyblocks.com/docs/js-filters/lzb-constructor-general-settings-keywords/"
source: "js-filters/lzb-constructor-general-settings-keywords.mdx"
---
# lzb.constructor.general-settings.keywords

Filters the Keywords field of the block builder general settings. Return a falsy value to hide it, which is what a site does when the keywords of a block are owned by code and editing them by hand would only cause drift.

## Attributes

| Name           | Type       | Description                              |
| -------------- | ---------- | ---------------------------------------- |
| `element`      | **JSX**    | `PanelBody` holding the keywords control |
| `settingsData` | **Object** | `data`, `updateData`                     |

`settingsData.data` is the whole block data, so `data.keywords` holds the current comma-separated value and `data.slug`, `data.icon`, `data.category` and `data.description` hold the values behind the other four general settings. `settingsData.updateData` shallow merges the object you pass it into that block data.

The five general settings render in a fixed order: slug, icon, category, keywords, description. This filter changes what stands in the keywords position, it cannot move the field.

## Usage

The builder renders the filtered value as `{settingsKeywords || null}`, so returning `null` takes the field off the screen.

```js title="JS"
wp.hooks.addFilter(
  "lzb.constructor.general-settings.keywords",
  "my.custom.namespace",
  function (element, settingsData) {
    const slug = settingsData.data.slug || "";

    if (slug.indexOf("lazyblock/generated-") !== 0) {
      return element;
    }

    return null;
  },
);
```

Hiding the field does not clear the stored value. A block saved earlier keeps the keywords it had and nothing in the builder can change them any more, so code that hides this field has to set `keywords` elsewhere, for example through [lzb/register_block_type_data](https://www.lazyblocks.com/docs/php-filters/lzb-register_block_type_data/). Do not call `updateData` from inside the filter, because it runs during render and dispatching there makes React warn about updating one component while another renders. The other four fields go through [lzb.constructor.general-settings.slug](https://www.lazyblocks.com/docs/js-filters/lzb-constructor-general-settings-slug/), [lzb.constructor.general-settings.icon](https://www.lazyblocks.com/docs/js-filters/lzb-constructor-general-settings-icon/), [lzb.constructor.general-settings.category](https://www.lazyblocks.com/docs/js-filters/lzb-constructor-general-settings-category/) and [lzb.constructor.general-settings.description](https://www.lazyblocks.com/docs/js-filters/lzb-constructor-general-settings-description/).

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