A WordPress-centric search engine for devs and theme authors



strip_core_block_namespace ›

Since5.3.1
Deprecatedn/a
strip_core_block_namespace ( $block_name = null )
Parameters:
  • (string) block_name Original block name.
    Required: No
    Default: null
Returns:
  • (string) Block name to use for serialization.
Defined at:
Codex:

Returns the block name to use for serialization. This will remove the default "core/" namespace from a block name.



Source

function strip_core_block_namespace( $block_name = null ) {
	if ( is_string( $block_name ) && 0 === strpos( $block_name, 'core/' ) ) {
		return substr( $block_name, 5 );
	}

	return $block_name;
}