Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: block_type_metadata

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

Line Code
242      $metadata['file'] = wp_normalize_path( $metadata_file );
243
244      /**
245       * Filters the metadata provided for registering a block type.
246       *
247       * @since 5.7.0
248       *
249       * @param array $metadata Metadata for registering a block type.
250       */
251      $metadata = apply_filters( 'block_type_metadata', $metadata );
252
253      // Add `style` and `editor_style` for core blocks if missing.
254      if ( ! empty( $metadata['name'] ) && 0 === strpos( $metadata['name'], 'core/' ) ) {
255           $block_name = str_replace( 'core/', '', $metadata['name'] );
256
257           if ( ! isset( $metadata['style'] ) ) {
258                $metadata['style'] = "wp-block-$block_name";
259           }
260           if ( ! isset( $metadata['editorStyle'] ) ) {