WP_Theme_JSON::get_custom_css
Deprecated since 6.7.0. It is no longer supported and may be removed in future releases. See get_stylesheet.
Returns the global styles custom CSS.
Method of the class: WP_Theme_JSON{}
No Hooks.
Returns
String. The global styles custom CSS.
Usage
$WP_Theme_JSON = new WP_Theme_JSON(); $WP_Theme_JSON->get_custom_css();
Changelog
| Since 6.2.0 | Introduced. |
| Deprecated since 6.7.0 | Use {@see 'get_stylesheet'} instead. |
WP_Theme_JSON::get_custom_css() WP Theme JSON::get custom css code WP 7.0
public function get_custom_css() {
_deprecated_function( __METHOD__, '6.7.0', 'get_stylesheet' );
// Add the global styles root CSS.
$stylesheet = $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 = $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;
}