block_has_support() – Checks whether the current block type supports the feature requested.

You appear to be a bot. Output may be restricted

Description

Checks whether the current block type supports the feature requested.

Usage

$bool = block_has_support( $block_type, $feature, $default );

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 – Optional. Fallback value for feature support. Default false.

Returns

bool Whether the feature is supported.

Source

File name: wordpress/wp-includes/blocks.php
Lines:

1 to 8 of 8
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 );
}
 

 View on GitHub View on Trac