Title: _remove_theme_attribute_from_template_part_block
Published: November 8, 2023
Last modified: May 20, 2026

---

# _remove_theme_attribute_from_template_part_block( array $block )

## In this article

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

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

This function’s access is marked private. This means it is not intended for use 
by plugin or theme developers, only by core. It is listed here for completeness.

Removes the `theme` attribute from a given template part block.

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

 `$block`arrayrequired

a parsed block.

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

    ```php
    function _remove_theme_attribute_from_template_part_block( &$block ) {
    	if (
    		'core/template-part' === $block['blockName'] &&
    		isset( $block['attrs']['theme'] )
    	) {
    		unset( $block['attrs']['theme'] );
    	}
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/block-template-utils.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.0/src/wp-includes/block-template-utils.php#L584)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/block-template-utils.php#L584-L591)

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

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

## User Contributed Notes

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