Normalizes a block name to ensure that missing implicit “core” namespaces are present.
Description
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' );Parameters
$block_typestringrequired- Valid block name, potentially without a namespace.
Source
public static function normalize_block_type( string $block_type ): string {
return false === strpos( $block_type, '/' )
? "core/{$block_type}"
: $block_type;
}
Changelog
| Version | Description |
|---|---|
| 6.9.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.