wp_get_block_style_variation_name_from_class()
Determines the block style variation names within a CSS class string.
No Hooks.
Returns
Array|null. The block style variation name if found.
Usage
wp_get_block_style_variation_name_from_class( $class_string );
- $class_string(string) (required)
- CSS class string to look for a variation in.
Changelog
| Since 6.6.0 | Introduced. |
wp_get_block_style_variation_name_from_class() wp get block style variation name from class code WP 6.9.1
function wp_get_block_style_variation_name_from_class( $class_string ) {
if ( ! is_string( $class_string ) ) {
return null;
}
preg_match_all( '/\bis-style-(?!default)(\S+)\b/', $class_string, $matches );
return $matches[1] ?? null;
}