WP_Theme_JSON::get_custom_css(): string

In this article

Returns the global styles custom CSS.

Return

string The global styles custom CSS.

Source

$blocks = array_diff_key( $blocks, static::$blocks_metadata );
if ( empty( $blocks ) ) {
	/*
	 * New block styles may have been registered within WP_Block_Styles_Registry.
	 * Update block metadata for any new block style variations.
	 */
	$registered_styles = $style_registry->get_all_registered();
	foreach ( static::$blocks_metadata as $block_name => $block_metadata ) {
		if ( ! empty( $registered_styles[ $block_name ] ) ) {
			$style_selectors = $block_metadata['styleVariations'] ?? array();

			foreach ( $registered_styles[ $block_name ] as $block_style ) {
				if ( ! isset( $style_selectors[ $block_style['name'] ] ) ) {
					$style_selectors[ $block_style['name'] ] = static::get_block_style_variation_selector( $block_style['name'], $block_metadata['selector'] );
				}
			}

Changelog

VersionDescription
6.2.0Introduced.

User Contributed Notes

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