WP_Theme_JSON::remove_indirect_properties( array $input, array $output )

In this article

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

Removes indirect properties from the given input node and sets in the given output node.

Parameters

$inputarrayrequired
Node to process.
$outputarrayrequired
The processed node. Passed by reference.

Source


/*
 * If there are content and wide widths in theme.json, output them
 * as custom properties on the body element so all blocks can use them.
 */
if ( isset( $settings['layout']['contentSize'] ) || isset( $settings['layout']['wideSize'] ) ) {
	$content_size = isset( $settings['layout']['contentSize'] ) ? $settings['layout']['contentSize'] : $settings['layout']['wideSize'];
	$content_size = static::is_safe_css_declaration( 'max-width', $content_size ) ? $content_size : 'initial';
	$wide_size    = isset( $settings['layout']['wideSize'] ) ? $settings['layout']['wideSize'] : $settings['layout']['contentSize'];
	$wide_size    = static::is_safe_css_declaration( 'max-width', $wide_size ) ? $wide_size : 'initial';
	$css         .= static::ROOT_CSS_PROPERTIES_SELECTOR . ' { --wp--style--global--content-size: ' . $content_size . ';';
	$css         .= '--wp--style--global--wide-size: ' . $wide_size . '; }';
}

Changelog

VersionDescription
6.2.0Introduced.

User Contributed Notes

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