Returns the block name to use for serialization. This will remove the default “core/” namespace from a block name.
$block_namestring|nulloptional
Default:null
function strip_core_block_namespace( $block_name = null ) {
if ( is_string( $block_name ) && str_starts_with( $block_name, 'core/' ) ) {
return substr( $block_name, 5 );
}
return $block_name;
}
| Version | Description |
|---|---|
| 5.3.1 | Introduced. |
© 2003–2024 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/strip_core_block_namespace