From 4b557cb26963ce822a89cee27e4c91c64b20f4b3 Mon Sep 17 00:00:00 2001 From: George Mamadashvili Date: Fri, 2 Apr 2021 12:46:31 +0400 Subject: [PATCH] Add 'object-position' to allowed inline style attributes list (#30243) --- lib/compat.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lib/compat.php b/lib/compat.php index e391b66aa1fed..a67bdce1de8cc 100644 --- a/lib/compat.php +++ b/lib/compat.php @@ -192,3 +192,18 @@ function gutenberg_override_reusable_block_post_type_labels() { ); } add_filter( 'post_type_labels_wp_block', 'gutenberg_override_reusable_block_post_type_labels', 10, 0 ); + +/** + * Update allowed inline style attributes list. + * + * Note: This should be removed when the minimum required WP version is >= 5.8. + * + * @param string[] $attrs Array of allowed CSS attributes. + * @return string[] CSS attributes. + */ +function gutenberg_safe_style_attrs( $attrs ) { + $attrs[] = 'object-position'; + + return $attrs; +} +add_filter( 'safe_style_css', 'gutenberg_safe_style_attrs' );