Title: WP_Theme_JSON::get_block_styles
Published: July 20, 2021
Last modified: November 4, 2021

---

# WP_Theme_JSON::get_block_styles( array $style_nodes, array $setting_nodes ): string

## In this article

 * [Description](https://developer.wordpress.org/reference/classes/wp_theme_json/get_block_styles/?output_format=md#description)
 * [Parameters](https://developer.wordpress.org/reference/classes/wp_theme_json/get_block_styles/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/classes/wp_theme_json/get_block_styles/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/classes/wp_theme_json/get_block_styles/?output_format=md#source)
 * [Changelog](https://developer.wordpress.org/reference/classes/wp_theme_json/get_block_styles/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/classes/wp_theme_json/get_block_styles/?output_format=md#wp--skip-link--target)

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

Converts each style section into a list of rulesets containing the block styles 
to be appended to the stylesheet.

## 󠀁[Description](https://developer.wordpress.org/reference/classes/wp_theme_json/get_block_styles/?output_format=md#description)󠁿

See glossary at [https://developer.mozilla.org/en-US/docs/Web/CSS/Syntax](https://developer.mozilla.org/en-US/docs/Web/CSS/Syntax)

For each section this creates a new ruleset such as:

block-selector { style-property-one: value; }

Additionally, it’ll also create new rulesets as classes for each preset value such
as:

    ```php
    .has-value-color {
      color: value;
    }

    .has-value-background-color {
      background-color: value;
    }

    .has-value-font-size {
      font-size: value;
    }

    .has-value-gradient-background {
      background: value;
    }

    p.has-value-gradient-background {
      background: value;
    }
    ```

## 󠀁[Parameters](https://developer.wordpress.org/reference/classes/wp_theme_json/get_block_styles/?output_format=md#parameters)󠁿

 `$style_nodes`arrayrequired

Nodes with styles.

`$setting_nodes`arrayrequired

Nodes with settings.

## 󠀁[Return](https://developer.wordpress.org/reference/classes/wp_theme_json/get_block_styles/?output_format=md#return)󠁿

 string The new stylesheet.

## 󠀁[Source](https://developer.wordpress.org/reference/classes/wp_theme_json/get_block_styles/?output_format=md#source)󠁿

    ```php
    	'backgroundRepeat'     => null,
    	'backgroundSize'       => null,
    	'backgroundAttachment' => null,
    ),
    'border'     => array(
    	'color'  => null,
    	'radius' => null,
    	'style'  => null,
    	'width'  => null,
    	'top'    => null,
    	'right'  => null,
    	'bottom' => null,
    	'left'   => null,
    ),
    'color'      => array(
    	'background' => null,
    	'gradient'   => null,
    	'text'       => null,
    ),
    'dimensions' => array(
    	'aspectRatio' => null,
    	'height'      => null,
    	'minHeight'   => null,
    	'width'       => null,
    ),
    'filter'     => array(
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/class-wp-theme-json.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.0/src/wp-includes/class-wp-theme-json.php#L558)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.0/src/wp-includes/class-wp-theme-json.php#L558-L583)

## 󠀁[Changelog](https://developer.wordpress.org/reference/classes/wp_theme_json/get_block_styles/?output_format=md#changelog)󠁿

| Version | Description | 
| [5.8.0](https://developer.wordpress.org/reference/since/5.8.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_theme_json%2Fget_block_styles%2F)
before being able to contribute a note or feedback.