Last active
October 26, 2022 01:51
-
-
Save peterwilsoncc/74ae0167e3a5d01502e7b1f94536a0fb to your computer and use it in GitHub Desktop.
Fix object-fit/featured image block bug introduced in WP 6.0.3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: Featured Image block bugfix for WP 6.0.3 | |
*/ | |
namespace PWCC\SafeCSSFeaturedImageBlockFix; | |
/** | |
* Add object-fit to supported CSS properties. | |
* | |
* This works around a bug introduced in WP 6.0.3 that caused the object-fit | |
* property to be stripped from CSS in the featured image block. | |
* | |
* @see https://core.trac.wordpress.org/ticket/56855 | |
* | |
* @param array $properties CSS properties considered safe by KSES. | |
* @return array CSS properties modified to include object-fit. | |
*/ | |
function safe_css( $properties ) { | |
$properties[] = 'object-fit'; | |
return $properties; | |
} | |
add_filter( 'safe_style_css', __NAMESPACE__ . '\\safe_css' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment