Title: register_block_style
Published: November 12, 2019
Last modified: February 24, 2026

---

# register_block_style( string|string[] $block_name, array $style_properties ): bool

## In this article

 * [Parameters](https://developer.wordpress.org/reference/functions/register_block_style/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/functions/register_block_style/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/functions/register_block_style/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/functions/register_block_style/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/register_block_style/?output_format=md#changelog)
 * [User Contributed Notes](https://developer.wordpress.org/reference/functions/register_block_style/?output_format=md#user-contributed-notes)

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

Registers a new block style.

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

 `$block_name`string|string[]required

Block type name including namespace or array of namespaced block type names.

`$style_properties`arrayrequired

Array containing the properties of the style name, label, style_handle (name of 
the stylesheet to be enqueued), inline_style (string containing the CSS to be added),
style_data (theme.json-like array to generate CSS from).
 See [WP_Block_Styles_Registry::register()](https://developer.wordpress.org/reference/classes/wp_block_styles_registry/register/).

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

 bool True if the block style was registered with success and false otherwise.

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

    ```php
    function register_block_style( $block_name, $style_properties ) {
    	return WP_Block_Styles_Registry::get_instance()->register( $block_name, $style_properties );
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/blocks.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-includes/blocks.php#L2529)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/blocks.php#L2529-L2531)

## 󠀁[Related](https://developer.wordpress.org/reference/functions/register_block_style/?output_format=md#related)󠁿

| Uses | Description | 
| [WP_Block_Styles_Registry::get_instance()](https://developer.wordpress.org/reference/classes/wp_block_styles_registry/get_instance/)`wp-includes/class-wp-block-styles-registry.php` |

Utility method to retrieve the main instance of the class.

  |

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

| Version | Description | 
| [6.6.0](https://developer.wordpress.org/reference/since/6.6.0/) | Added support for registering styles for multiple block types. | 
| [5.3.0](https://developer.wordpress.org/reference/since/5.3.0/) | Introduced. |

## 󠀁[User Contributed Notes](https://developer.wordpress.org/reference/functions/register_block_style/?output_format=md#user-contributed-notes)󠁿

 1.   [Skip to note 2 content](https://developer.wordpress.org/reference/functions/register_block_style/?output_format=md#comment-content-5198)
 2.    [Marcio Duarte](https://profiles.wordpress.org/pagelab/)  [  5 years ago  ](https://developer.wordpress.org/reference/functions/register_block_style/#comment-5198)
 3.  [You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fregister_block_style%2F%23comment-5198)
     Vote results for this note: 6[You must log in to vote on the helpfulness of this note](https://login.wordpress.org?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fregister_block_style%2F%23comment-5198)
 4.  The only mandatory properties of the `$style_properties` array are `name` and `
     label`:
 5.   * `name`: the identifier of the style used to compute a CSS class.
      * `label`: a human-readable label for the style.
 6.  The array can optionally include `inline_style` or `style_handle`, in order to
     choose how to load the required CSS:
 7.   * `inline_style`: contains inline CSS code that registers the CSS class required
        for the style. All inline block styles will appear in the `head` tag.
      * `style_handle`: contains the handle to an already registered style that should
        be enqueued in places where block styles are needed. Using this option gives
        you more control over where to enqueue the CSS.
 8.  Also optional: set the `is_default` property to `true` to mark one of the block
     styles as the default one.
 9.  **Tip:** to find the correct block name, open the block editor, launch the browser
     console and type `wp.blocks.getBlockTypes()`. You will see the complete list of
     block names (from core or third-party).
 10. Complete example:
 11.     ```php
         if ( function_exists( 'register_block_style' ) ) {
             register_block_style(
                 'core/quote',
                 array(
                     'name'         => 'blue-quote',
                     'label'        => __( 'Blue Quote', 'textdomain' ),
                     'is_default'   => true,
                     'inline_style' => '.wp-block-quote.is-style-blue-quote { color: blue; }',
                 )
             );
         }
         ```
     
 12. For more information, see the [Developer Handbook](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-styles/#server-side-registration-helper).
 13.  * the inline_style should not prepend the class with “is-style-“
      * [Feast Design Co.](https://profiles.wordpress.org/feastdesignco/) [2 years ago](https://developer.wordpress.org/reference/functions/register_block_style/#comment-6857)
 14.  [Log in to add feedback](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fregister_block_style%2F%3Freplytocom%3D5198%23feedback-editor-5198)

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