WordPress Version: 5.8
/**
* Checks whether the current block type supports the feature requested.
*
* @since 5.8.0
*
* @param WP_Block_Type $block_type Block type to check for support.
* @param string $feature Name of the feature to check support for.
* @param mixed $default Fallback value for feature support, defaults to false.
*
* @return boolean Whether or not the feature is supported.
*/
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);
}