WP_Block_Styles_Registry::get_registered_styles_for_block() WordPress Method

The WP_Block_Styles_Registry::get_registered_styles_for_block() method is used to get all registered styles for a given block. This is useful for blocks that allow the user to select from a number of different styles.

WP_Block_Styles_Registry::get_registered_styles_for_block( string $block_name ) #

Retrieves registered block styles for a specific block type.


Parameters

$block_name

(string)(Required)Block type name including namespace.


Top ↑

Return

(array[]) Array whose keys are block style names and whose values are block style properties.


Top ↑

Source

File: wp-includes/class-wp-block-styles-registry.php

	public function get_registered_styles_for_block( $block_name ) {
		if ( isset( $this->registered_block_styles[ $block_name ] ) ) {
			return $this->registered_block_styles[ $block_name ];
		}
		return array();
	}

Top ↑

Changelog

Changelog
VersionDescription
5.3.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.