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.7.1

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

    	 * 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
    	};
    
    	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 451
    	 * @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: