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
260      $metadata['file'] = wp_normalize_path( realpath( $metadata_file ) );
261
262      /**
263       * Filters the metadata provided for registering a block type.
264       *
265       * @since 5.7.0
266       *
267       * @param array $metadata Metadata for registering a block type.
268       */
269      $metadata = apply_filters( 'block_type_metadata', $metadata );
270
271      // Add `style` and `editor_style` for core blocks if missing.
272      if ( ! empty( $metadata['name'] ) && 0 === strpos( $metadata['name'], 'core/' ) ) {
273           $block_name = str_replace( 'core/', '', $metadata['name'] );
274
275           if ( ! isset( $metadata['style'] ) ) {
276                $metadata['style'] = "wp-block-$block_name";
277           }
278           if ( ! isset( $metadata['editorStyle'] ) ) {