diff --git a/packages/block-editor/src/hooks/align.js b/packages/block-editor/src/hooks/align.js
index 5c650af91f16a..f46b7fc029bc2 100644
--- a/packages/block-editor/src/hooks/align.js
+++ b/packages/block-editor/src/hooks/align.js
@@ -94,6 +94,9 @@ export function addAttribute( settings ) {
...settings.attributes,
align: {
type: 'string',
+ // Allow for '' since it is used by updateAlignment function
+ // in withToolbarControls for special cases with defined default values.
+ enum: [ ...ALL_ALIGNMENTS, '' ],
},
};
}
diff --git a/packages/block-library/src/archives/index.php b/packages/block-library/src/archives/index.php
index 3499c8599c899..b2a8b12b61f9d 100644
--- a/packages/block-library/src/archives/index.php
+++ b/packages/block-library/src/archives/index.php
@@ -19,10 +19,6 @@ function render_block_core_archives( $attributes ) {
$class = 'wp-block-archives';
- if ( isset( $attributes['align'] ) ) {
- $class .= " align{$attributes['align']}";
- }
-
if ( isset( $attributes['className'] ) ) {
$class .= " {$attributes['className']}";
}
diff --git a/packages/block-library/src/calendar/index.php b/packages/block-library/src/calendar/index.php
index 169adf2131eda..d45ebad36e9d6 100644
--- a/packages/block-library/src/calendar/index.php
+++ b/packages/block-library/src/calendar/index.php
@@ -32,11 +32,10 @@ function render_block_core_calendar( $attributes ) {
}
$custom_class_name = empty( $attributes['className'] ) ? '' : ' ' . $attributes['className'];
- $align_class_name = empty( $attributes['align'] ) ? '' : ' ' . "align{$attributes['align']}";
$output = sprintf(
'
%2$s
',
- esc_attr( 'wp-block-calendar' . $custom_class_name . $align_class_name ),
+ esc_attr( 'wp-block-calendar' . $custom_class_name ),
get_calendar( true, false )
);
diff --git a/packages/block-library/src/categories/block.json b/packages/block-library/src/categories/block.json
index c5ecd8deb26b3..0194ee9c62971 100644
--- a/packages/block-library/src/categories/block.json
+++ b/packages/block-library/src/categories/block.json
@@ -2,16 +2,6 @@
"name": "core/categories",
"category": "widgets",
"attributes": {
- "align": {
- "type": "string",
- "enum": [
- "left",
- "center",
- "right",
- "wide",
- "full"
- ]
- },
"className": {
"type": "string"
},
diff --git a/packages/block-library/src/categories/index.php b/packages/block-library/src/categories/index.php
index 34dc2c959d0bf..14201f495a970 100644
--- a/packages/block-library/src/categories/index.php
+++ b/packages/block-library/src/categories/index.php
@@ -43,10 +43,6 @@ function render_block_core_categories( $attributes ) {
$class = "wp-block-categories wp-block-categories-{$type}";
- if ( isset( $attributes['align'] ) ) {
- $class .= " align{$attributes['align']}";
- }
-
if ( isset( $attributes['className'] ) ) {
$class .= " {$attributes['className']}";
}
diff --git a/packages/block-library/src/latest-comments/index.php b/packages/block-library/src/latest-comments/index.php
index 20a38627929d0..150c586cfd6b0 100644
--- a/packages/block-library/src/latest-comments/index.php
+++ b/packages/block-library/src/latest-comments/index.php
@@ -120,9 +120,6 @@ function render_block_core_latest_comments( $attributes = array() ) {
if ( ! empty( $attributes['className'] ) ) {
$class .= ' ' . $attributes['className'];
}
- if ( isset( $attributes['align'] ) ) {
- $class .= " align{$attributes['align']}";
- }
if ( $attributes['displayAvatar'] ) {
$class .= ' has-avatars';
}
diff --git a/packages/block-library/src/latest-posts/block.json b/packages/block-library/src/latest-posts/block.json
index da7d40bbc9ab1..8ecb71a666db4 100644
--- a/packages/block-library/src/latest-posts/block.json
+++ b/packages/block-library/src/latest-posts/block.json
@@ -2,16 +2,6 @@
"name": "core/latest-posts",
"category": "widgets",
"attributes": {
- "align": {
- "type": "string",
- "enum": [
- "left",
- "center",
- "right",
- "wide",
- "full"
- ]
- },
"className": {
"type": "string"
},
diff --git a/packages/block-library/src/latest-posts/index.php b/packages/block-library/src/latest-posts/index.php
index 837b8aa14511a..4dc1efa151481 100644
--- a/packages/block-library/src/latest-posts/index.php
+++ b/packages/block-library/src/latest-posts/index.php
@@ -145,9 +145,6 @@ function render_block_core_latest_posts( $attributes ) {
remove_filter( 'excerpt_length', 'block_core_latest_posts_get_excerpt_length', 20 );
$class = 'wp-block-latest-posts wp-block-latest-posts__list';
- if ( isset( $attributes['align'] ) ) {
- $class .= ' align' . $attributes['align'];
- }
if ( isset( $attributes['postLayout'] ) && 'grid' === $attributes['postLayout'] ) {
$class .= ' is-grid';
diff --git a/packages/block-library/src/navigation/index.php b/packages/block-library/src/navigation/index.php
index e28c521667101..d7babf262c30a 100644
--- a/packages/block-library/src/navigation/index.php
+++ b/packages/block-library/src/navigation/index.php
@@ -133,8 +133,7 @@ function render_block_core_navigation( $attributes, $content, $block ) {
array( 'wp-block-navigation' ),
isset( $attributes['className'] ) ? array( $attributes['className'] ) : array(),
( isset( $attributes['orientation'] ) && 'vertical' === $attributes['orientation'] ) ? array( 'is-vertical' ) : array(),
- isset( $attributes['itemsJustification'] ) ? array( 'items-justified-' . $attributes['itemsJustification'] ) : array(),
- isset( $attributes['align'] ) ? array( 'align' . $attributes['align'] ) : array()
+ isset( $attributes['itemsJustification'] ) ? array( 'items-justified-' . $attributes['itemsJustification'] ) : array()
);
$class_attribute = sprintf( ' class="%s"', esc_attr( implode( ' ', $classes ) ) );
$style_attribute = ( $colors['inline_styles'] || $font_sizes['inline_styles'] )
diff --git a/packages/block-library/src/rss/index.php b/packages/block-library/src/rss/index.php
index 54c1b7d4b78c4..3f1e85ae1c407 100644
--- a/packages/block-library/src/rss/index.php
+++ b/packages/block-library/src/rss/index.php
@@ -80,10 +80,6 @@ function render_block_core_rss( $attributes ) {
}
$class = 'wp-block-rss';
- if ( isset( $attributes['align'] ) ) {
- $class .= ' align' . $attributes['align'];
- }
-
if ( isset( $attributes['blockLayout'] ) && 'grid' === $attributes['blockLayout'] ) {
$class .= ' is-grid';
}
diff --git a/packages/block-library/src/search/block.json b/packages/block-library/src/search/block.json
index b6b2bf79e0eb9..ea0e247ae9e53 100644
--- a/packages/block-library/src/search/block.json
+++ b/packages/block-library/src/search/block.json
@@ -2,16 +2,6 @@
"name": "core/search",
"category": "widgets",
"attributes": {
- "align": {
- "type": "string",
- "enum": [
- "left",
- "center",
- "right",
- "wide",
- "full"
- ]
- },
"className": {
"type": "string"
},
diff --git a/packages/block-library/src/search/index.php b/packages/block-library/src/search/index.php
index 55f0cadf0fe07..d7209352ba6a9 100644
--- a/packages/block-library/src/search/index.php
+++ b/packages/block-library/src/search/index.php
@@ -63,9 +63,6 @@ function render_block_core_search( $attributes ) {
if ( isset( $attributes['className'] ) ) {
$class .= ' ' . $attributes['className'];
}
- if ( isset( $attributes['align'] ) ) {
- $class .= ' align' . $attributes['align'];
- }
return sprintf(
'',
diff --git a/packages/block-library/src/tag-cloud/index.php b/packages/block-library/src/tag-cloud/index.php
index 419ef3477ed25..12d2a288217bd 100644
--- a/packages/block-library/src/tag-cloud/index.php
+++ b/packages/block-library/src/tag-cloud/index.php
@@ -13,9 +13,7 @@
* @return string Returns the tag cloud for selected taxonomy.
*/
function render_block_core_tag_cloud( $attributes ) {
- $class = isset( $attributes['align'] ) ?
- "wp-block-tag-cloud align{$attributes['align']}" :
- 'wp-block-tag-cloud';
+ $class = 'wp-block-tag-cloud';
if ( isset( $attributes['className'] ) ) {
$class .= ' ' . $attributes['className'];
diff --git a/packages/e2e-tests/fixtures/blocks/core__button__squared.html b/packages/e2e-tests/fixtures/blocks/core__button__squared.html
index 7df5372a100b6..14aa9b56305fa 100644
--- a/packages/e2e-tests/fixtures/blocks/core__button__squared.html
+++ b/packages/e2e-tests/fixtures/blocks/core__button__squared.html
@@ -1,3 +1,3 @@
-
+
diff --git a/packages/e2e-tests/fixtures/blocks/core__button__squared.json b/packages/e2e-tests/fixtures/blocks/core__button__squared.json
index 1e97cd0ba5209..f0503379bdd01 100644
--- a/packages/e2e-tests/fixtures/blocks/core__button__squared.json
+++ b/packages/e2e-tests/fixtures/blocks/core__button__squared.json
@@ -11,8 +11,7 @@
"text": "#1b9b6c",
"background": "#aa5a20"
}
- },
- "align": "none"
+ }
},
"innerBlocks": [],
"originalContent": ""
diff --git a/packages/e2e-tests/fixtures/blocks/core__button__squared.parsed.json b/packages/e2e-tests/fixtures/blocks/core__button__squared.parsed.json
index 4ddc882a14ae7..746e883257e7e 100644
--- a/packages/e2e-tests/fixtures/blocks/core__button__squared.parsed.json
+++ b/packages/e2e-tests/fixtures/blocks/core__button__squared.parsed.json
@@ -3,7 +3,6 @@
"blockName": "core/button",
"attrs": {
"borderRadius": 0,
- "align": "none",
"style": {
"color": {
"text": "#1b9b6c",
diff --git a/packages/e2e-tests/fixtures/blocks/core__button__squared.serialized.html b/packages/e2e-tests/fixtures/blocks/core__button__squared.serialized.html
index 0ed8558bc1582..aea05e9fe5eba 100644
--- a/packages/e2e-tests/fixtures/blocks/core__button__squared.serialized.html
+++ b/packages/e2e-tests/fixtures/blocks/core__button__squared.serialized.html
@@ -1,3 +1,3 @@
-
+