wpseek.com
A WordPress-centric search engine for devs and theme authors



_inject_theme_attribute_in_template_part_block › WordPress Function

Since6.4.0
Deprecatedn/a
_inject_theme_attribute_in_template_part_block ( $block )
Access:
  • private
Parameters:
  • (array) $block a parsed block.
    Required: Yes
Defined at:
Codex:

Injects the active theme's stylesheet as a `theme` attribute into a given template part block.



Source

function _inject_theme_attribute_in_template_part_block( &$block ) {
	if (
		'core/template-part' === $block['blockName'] &&
		! isset( $block['attrs']['theme'] )
	) {
		$block['attrs']['theme'] = get_stylesheet();
	}
}