Title: strip_core_block_namespace
Published: April 1, 2020
Last modified: February 24, 2026

---

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

## In this article

 * [Parameters](https://developer.wordpress.org/reference/functions/strip_core_block_namespace/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/functions/strip_core_block_namespace/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/functions/strip_core_block_namespace/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/functions/strip_core_block_namespace/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/strip_core_block_namespace/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/functions/strip_core_block_namespace/?output_format=md#wp--skip-link--target)

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

## 󠀁[Parameters](https://developer.wordpress.org/reference/functions/strip_core_block_namespace/?output_format=md#parameters)󠁿

 `$block_name`string|nulloptional

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

Default:`null`

## 󠀁[Return](https://developer.wordpress.org/reference/functions/strip_core_block_namespace/?output_format=md#return)󠁿

 string Block name to use for serialization.

## 󠀁[Source](https://developer.wordpress.org/reference/functions/strip_core_block_namespace/?output_format=md#source)󠁿

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

[View all references](https://developer.wordpress.org/reference/files/wp-includes/blocks.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-includes/blocks.php#L1649)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/blocks.php#L1649-L1655)

## 󠀁[Related](https://developer.wordpress.org/reference/functions/strip_core_block_namespace/?output_format=md#related)󠁿

| Used by | Description | 
| [get_comment_delimited_block_content()](https://developer.wordpress.org/reference/functions/get_comment_delimited_block_content/)`wp-includes/blocks.php` |

Returns the content of a block, including comment delimiters.

  | 
| [has_block()](https://developer.wordpress.org/reference/functions/has_block/)`wp-includes/blocks.php` |

Determines whether a $post or a string contains a specific block type.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/strip_core_block_namespace/?output_format=md#changelog)󠁿

| Version | Description | 
| [5.3.1](https://developer.wordpress.org/reference/since/5.3.1/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fstrip_core_block_namespace%2F)
before being able to contribute a note or feedback.