block_type_metadata

block_type_metadata

Appears in: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
Hook Type: filter
See hook in action

See hook in core

Displaying hooks found in version: wordpress-6.8

apply_filters('block_type_metadata') is found 3 times:

  • /wp-includes/blocks/comments.php line 223

    Warning: Undefined array key 227 in /home/c6974294/public_html/wp-plugin-api.com/wp-content/themes/wordpress-hooks/functions.php on line 167

    Warning: Undefined array key 228 in /home/c6974294/public_html/wp-plugin-api.com/wp-content/themes/wordpress-hooks/functions.php on line 167

    219
    220
    221
    222
    223
    224
    225
    226
    227
         * like `_wp_multiple_block_styles`, which is required in this case because
         * the block has multiple styles.
         */
        /** This filter is documented in wp-includes/blocks.php */
        $metadata = apply_filters( 'block_type_metadata', $metadata );
     
        register_block_type( 'core/post-comments', $metadata );
    }
    add_action( 'init', 'register_legacy_post_comments_block', 21 );
  • /wp-includes/blocks/index.php line 122
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    };
     
    foreach ( $core_blocks_meta as $name => $schema ) {
        /** This filter is documented in wp-includes/blocks.php */
        $schema = apply_filters( 'block_type_metadata', $schema );
     
        // Backfill these properties similar to `register_block_type_from_metadata()`.
        if ( ! isset( $schema['style'] ) ) {
            $schema['style'] = "wp-block-{$name}";
        }
        if ( ! isset( $schema['editorStyle'] ) ) {
  • /wp-includes/blocks.php line 479
    475
    476
    477
    478
    479
    480
    481
    482
    483
    484
    485
    * @since 5.7.0
     *
     * @param array $metadata Metadata for registering a block type.
     */
    $metadata = apply_filters( 'block_type_metadata', $metadata );
     
    // Add `style` and `editor_style` for core blocks if missing.
    if ( ! empty( $metadata['name'] ) && str_starts_with( $metadata['name'], 'core/' ) ) {
        $block_name = str_replace( 'core/', '', $metadata['name'] );
     
        if ( ! isset( $metadata['style'] ) ) {

See this hook used in plugins: