Title: block_type_metadata
Published: March 9, 2021
Last modified: February 24, 2026

---

# apply_filters( ‘block_type_metadata’, array $metadata )

## In this article

 * [Parameters](https://developer.wordpress.org/reference/hooks/block_type_metadata/?output_format=md#parameters)
 * [Source](https://developer.wordpress.org/reference/hooks/block_type_metadata/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/hooks/block_type_metadata/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/hooks/block_type_metadata/?output_format=md#changelog)
 * [User Contributed Notes](https://developer.wordpress.org/reference/hooks/block_type_metadata/?output_format=md#user-contributed-notes)

[ Back to top](https://developer.wordpress.org/reference/hooks/block_type_metadata/?output_format=md#wp--skip-link--target)

Filters the metadata provided for registering a block type.

## 󠀁[Parameters](https://developer.wordpress.org/reference/hooks/block_type_metadata/?output_format=md#parameters)󠁿

 `$metadata`array

Metadata for registering a block type.

## 󠀁[Source](https://developer.wordpress.org/reference/hooks/block_type_metadata/?output_format=md#source)󠁿

    ```php
    $metadata = apply_filters( 'block_type_metadata', $metadata );
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/blocks.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-includes/blocks.php#L500)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/blocks.php#L500-L500)

## 󠀁[Related](https://developer.wordpress.org/reference/hooks/block_type_metadata/?output_format=md#related)󠁿

| Used by | Description | 
| [register_block_type_from_metadata()](https://developer.wordpress.org/reference/functions/register_block_type_from_metadata/)`wp-includes/blocks.php` |

Registers a block type from the metadata stored in the `block.json` file.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/hooks/block_type_metadata/?output_format=md#changelog)󠁿

| Version | Description | 
| [5.7.0](https://developer.wordpress.org/reference/since/5.7.0/) | Introduced. |

## 󠀁[User Contributed Notes](https://developer.wordpress.org/reference/hooks/block_type_metadata/?output_format=md#user-contributed-notes)󠁿

 1.   [Skip to note 3 content](https://developer.wordpress.org/reference/hooks/block_type_metadata/?output_format=md#comment-content-5769)
 2.    [Elvis Morales](https://profiles.wordpress.org/elvismdev/)  [  4 years ago  ](https://developer.wordpress.org/reference/hooks/block_type_metadata/#comment-5769)
 3.  [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fblock_type_metadata%2F%23comment-5769)
     Vote results for this note: 2[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fblock_type_metadata%2F%23comment-5769)
 4.      ```php
         /**
          * Add custom 'visibleOnMobile' attribute to the core/group block.
          *
          * @param array $metadata Metadata for registering a block type.
          * @return array
          */
         function my_filter_block_type_metadata( $metadata ) {
         	if ( 'core/group' === $metadata['name'] ) {
         		$metadata['attributes']['visibleOnMobile'] = array(
         			'type'    => 'boolean',
         			'default' => false,
         		);
         	}
         	return $metadata;
         }
         add_filter( 'block_type_metadata', 'my_filter_block_type_metadata' );
         ```
     
 5.   [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fblock_type_metadata%2F%3Freplytocom%3D5769%23feedback-editor-5769)
 6.   [Skip to note 4 content](https://developer.wordpress.org/reference/hooks/block_type_metadata/?output_format=md#comment-content-6904)
 7.    [Lovro Hrust](https://profiles.wordpress.org/lovor/)  [  2 years ago  ](https://developer.wordpress.org/reference/hooks/block_type_metadata/#comment-6904)
 8.  [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fblock_type_metadata%2F%23comment-6904)
     Vote results for this note: 0[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fblock_type_metadata%2F%23comment-6904)
 9.  If you use method to add additional attributes similar to shown above from Elvis
     Morales, it is **obligatory** to set ‘default’ key, otherwise adding block attribute
     will fail without error message.
 10.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fblock_type_metadata%2F%3Freplytocom%3D6904%23feedback-editor-6904)

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fblock_type_metadata%2F)
before being able to contribute a note or feedback.