block_has_support()
Checks whether the current block type supports the feature requested.
Хуков нет.
Возвращает
true|false
. Whether the feature is supported.
Использование
block_has_support( $block_type, $feature, $default_value );
- $block_type(WP_Block_Type) (обязательный)
- Block type to check for support.
- $feature(массив) (обязательный)
- Path to a specific feature to check support for.
- $default_value(разное)
- Fallback value for feature support.
По умолчанию: false
Список изменений
С версии 5.8.0 | Введена. |
Код block_has_support() block has support WP 6.2.2
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 ); }