wp_should_skip_block_supports_serialization

函数
wp_should_skip_block_supports_serialization ( $block_type, $feature_set, $feature = null )
Access
Private
参数
  • (WP_Block_Type) $block_type Block type.
    Required:
  • (string) $feature_set Name of block support feature set..
    Required:
  • (string) $feature Optional name of individual feature to check.
    Required:
    Default: null
返回值
  • (bool) Whether to serialize block support styles & classes.
定义位置
相关方法
wp_skip_border_serializationwp_skip_spacing_serializationwp_skip_dimensions_serializationwp_enqueue_block_support_styleswpmu_signup_blog_notification
引入
6.0.0
弃用
-

wp_should_skip_block_supports_serialization 是一个用来确定是否应该跳过块支持数据的序列化的函数。

检查是否应该对当前块的支持属性进行序列化。

function wp_should_skip_block_supports_serialization( $block_type, $feature_set, $feature = null ) {
	if ( ! is_object( $block_type ) || ! $feature_set ) {
		return false;
	}

	$path               = array( $feature_set, '__experimentalSkipSerialization' );
	$skip_serialization = _wp_array_get( $block_type->supports, $path, false );

	if ( is_array( $skip_serialization ) ) {
		return in_array( $feature, $skip_serialization, true );
	}

	return $skip_serialization;
}

常见问题

FAQs
查看更多 >