strip_core_block_namespace() WordPress Function

This function will remove the block-editor namespace from core blocks.

strip_core_block_namespace( string $block_name = null ) #

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


Parameters

$block_name

(string)(Optional)Original block name.

Default value: null


Top ↑

Return

(string) Block name to use for serialization.


Top ↑

Source

File: wp-includes/blocks.php

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


Top ↑

Changelog

Changelog
VersionDescription
5.3.1Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.