block_has_support( WP_Block_Type $block_type, string $feature, mixed $default = false )

Checks whether the current block type supports the feature requested.

Parameters

$block_type

(WP_Block_Type) (Required) Block type to check for support.

$feature

(string) (Required) Name of the feature to check support for.

$default

(mixed) (Optional) Fallback value for feature support, defaults to false.

Default value: false

Return

(boolean) Whether or not the feature is supported.

Source

File: wp-includes/blocks.php

function block_has_support( $block_type, $feature, $default = false ) {
	$block_support = $default;
	if ( $block_type && property_exists( $block_type, 'supports' ) ) {
		$block_support = _wp_array_get( $block_type->supports, $feature, $default );
	}

	return true === $block_support || is_array( $block_support );
}

Changelog

Version Description
5.8.0 Introduced.

© 2003–2021 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/block_has_support