Title: get_block_editor_theme_styles
Published: July 20, 2021
Last modified: February 24, 2026

---

# get_block_editor_theme_styles(): array

## In this article

 * [Return](https://developer.wordpress.org/reference/functions/get_block_editor_theme_styles/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/functions/get_block_editor_theme_styles/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/functions/get_block_editor_theme_styles/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/get_block_editor_theme_styles/?output_format=md#changelog)

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

Creates an array of theme styles to load into the block editor.

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

 array An array of theme styles for the block editor.

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

    ```php
    function get_block_editor_theme_styles() {
    	global $editor_styles;

    	$styles = array();

    	if ( $editor_styles && current_theme_supports( 'editor-styles' ) ) {
    		foreach ( $editor_styles as $style ) {
    			if ( preg_match( '~^(https?:)?//~', $style ) ) {
    				$response = wp_remote_get( $style );
    				if ( ! is_wp_error( $response ) ) {
    					$styles[] = array(
    						'css'            => wp_remote_retrieve_body( $response ),
    						'__unstableType' => 'theme',
    						'isGlobalStyles' => false,
    					);
    				}
    			} else {
    				$file = get_theme_file_path( $style );
    				if ( is_file( $file ) ) {
    					$styles[] = array(
    						'css'            => file_get_contents( $file ),
    						'baseURL'        => get_theme_file_uri( $style ),
    						'__unstableType' => 'theme',
    						'isGlobalStyles' => false,
    					);
    				}
    			}
    		}
    	}

    	return $styles;
    }
    ```

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

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

| Uses | Description | 
| [get_theme_file_path()](https://developer.wordpress.org/reference/functions/get_theme_file_path/)`wp-includes/link-template.php` |

Retrieves the path of a file in the theme.

  | 
| [get_theme_file_uri()](https://developer.wordpress.org/reference/functions/get_theme_file_uri/)`wp-includes/link-template.php` |

Retrieves the URL of a file in the theme.

  | 
| [wp_remote_get()](https://developer.wordpress.org/reference/functions/wp_remote_get/)`wp-includes/http.php` |

Performs an HTTP request using the GET method and returns its response.

  | 
| [wp_remote_retrieve_body()](https://developer.wordpress.org/reference/functions/wp_remote_retrieve_body/)`wp-includes/http.php` |

Retrieves only the body from the raw response.

  | 
| [current_theme_supports()](https://developer.wordpress.org/reference/functions/current_theme_supports/)`wp-includes/theme.php` |

Checks a theme’s support for a given feature.

  | 
| [is_wp_error()](https://developer.wordpress.org/reference/functions/is_wp_error/)`wp-includes/load.php` |

Checks whether the given variable is a WordPress Error.

  |

[Show 2 more](https://developer.wordpress.org/reference/functions/get_block_editor_theme_styles/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/functions/get_block_editor_theme_styles/?output_format=md#)

| Used by | Description | 
| [get_block_editor_settings()](https://developer.wordpress.org/reference/functions/get_block_editor_settings/)`wp-includes/block-editor.php` |

Returns the contextualized block editor settings for a selected editor context.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/get_block_editor_theme_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%2Ffunctions%2Fget_block_editor_theme_styles%2F)
before being able to contribute a note or feedback.