strip_core_block_namespace( string|null $block_name = null ): string

In this article

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

Parameters

$block_namestring|nulloptional
Original block name. Null if the block name is unknown, e.g. Classic blocks have their name set to null.

Default:null

Return

string Block name to use for serialization.

Source

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;
}

Changelog

VersionDescription
5.3.1Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.