WP_Theme_JSON::get_custom_css(): string

In this article

This method has been deprecated. Use {@see ‘get_stylesheet’} instead.

Returns the global styles custom CSS.

Return

string The global styles custom CSS.

Source

public function get_custom_css() {
	_deprecated_function( __METHOD__, '6.7.0', 'get_stylesheet' );
	// Add the global styles root CSS.
	$stylesheet = isset( $this->theme_json['styles']['css'] ) ? $this->theme_json['styles']['css'] : '';

	// Add the global styles block CSS.
	if ( isset( $this->theme_json['styles']['blocks'] ) ) {
		foreach ( $this->theme_json['styles']['blocks'] as $name => $node ) {
			$custom_block_css = isset( $this->theme_json['styles']['blocks'][ $name ]['css'] )
				? $this->theme_json['styles']['blocks'][ $name ]['css']
				: null;
			if ( $custom_block_css ) {
				$selector    = static::$blocks_metadata[ $name ]['selector'];
				$stylesheet .= $this->process_blocks_custom_css( $custom_block_css, $selector );
			}
		}
	}

	return $stylesheet;
}

Changelog

VersionDescription
6.7.0Use 'get_stylesheet' instead.
6.2.0Introduced.

User Contributed Notes

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