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
345      $metadata['file'] = wp_normalize_path( realpath( $metadata_file ) );
346
347      /**
348       * Filters the metadata provided for registering a block type.
349       *
350       * @since 5.7.0
351       *
352       * @param array $metadata Metadata for registering a block type.
353       */
354      $metadata = apply_filters( 'block_type_metadata', $metadata );
355
356      // Add `style` and `editor_style` for core blocks if missing.
357      if ( ! empty( $metadata['name'] ) && 0 === strpos( $metadata['name'], 'core/' ) ) {
358           $block_name = str_replace( 'core/', '', $metadata['name'] );
359
360           if ( ! isset( $metadata['style'] ) ) {
361                $metadata['style'] = "wp-block-$block_name";
362           }
363           if ( ! isset( $metadata['editorStyle'] ) ) {