diff --git a/lib/block-supports/border.php b/lib/block-supports/border.php index 0861119c3a32f3..feecb788443a29 100644 --- a/lib/block-supports/border.php +++ b/lib/block-supports/border.php @@ -38,6 +38,16 @@ function gutenberg_register_border_support( $block_type ) { * @return array Border CSS classes and inline styles. */ function gutenberg_apply_border_support( $block_type, $block_attributes ) { + $border_support = _wp_array_get( $block_type->supports, array( '__experimentalBorder' ), false ); + + if ( + is_array( $border_support ) && + array_key_exists( '__experimentalSkipSerialization', $border_support ) && + $border_support['__experimentalSkipSerialization'] + ) { + return array(); + } + // Arrays used to ease addition of further border related features in future. $styles = array(); diff --git a/packages/block-editor/src/hooks/style.js b/packages/block-editor/src/hooks/style.js index 702da2ae7983f0..b1c7239b2d791d 100644 --- a/packages/block-editor/src/hooks/style.js +++ b/packages/block-editor/src/hooks/style.js @@ -128,6 +128,7 @@ export function addSaveProps( props, blockType, attributes ) { const { style } = attributes; const filteredStyle = omitKeysNotToSerialize( style, { + border: getBlockSupport( blockType, BORDER_SUPPORT_KEY ), [ COLOR_SUPPORT_KEY ]: getBlockSupport( blockType, COLOR_SUPPORT_KEY ), } ); props.style = {