WP_Block_Processor::normalize_block_type
Normalizes a block name to ensure that missing implicit “core” namespaces are present.
Example:
'core/paragraph' === WP_Block_Processor::normalize_block_byte( 'paragraph' ); 'core/paragraph' === WP_Block_Processor::normalize_block_byte( 'core/paragraph' ); 'my/paragraph' === WP_Block_Processor::normalize_block_byte( 'my/paragraph' );
Method of the class: WP_Block_Processor{}
No Hooks.
Returns
String. Fully-qualified block type including namespace.
Usage
$result = WP_Block_Processor::normalize_block_type( $block_type ): string;
- $block_type(string) (required)
- Valid block name, potentially without a namespace.
Changelog
| Since 6.9.0 | Introduced. |
WP_Block_Processor::normalize_block_type() WP Block Processor::normalize block type code WP 6.9.1
public static function normalize_block_type( string $block_type ): string {
return false === strpos( $block_type, '/' )
? "core/{$block_type}"
: $block_type;
}