wpseek.com
A WordPress-centric search engine for devs and theme authors



block_has_support › WordPress Function

Since5.8.0
Deprecatedn/a
block_has_support ( $block_type, $feature, $default_value = false )
Parameters: (3)
  • (WP_Block_Type) $block_type Block type to check for support.
    Required: Yes
  • (array) $feature Path to a specific feature to check support for.
    Required: Yes
  • (mixed) $default_value Optional. Fallback value for feature support. Default false.
    Required: No
    Default: false
Returns:
  • (bool) Whether the feature is supported.
Defined at:
Codex:

Checks whether the current block type supports the feature requested.



Source

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

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