wp_get_typography_value_and_unit
wp_get_typography_value_and_unit ( $raw_value, $options = array() )
Parameters:- (string|int|float) raw_value Raw size value from theme.json.
- (array) options {
Optional. An associative array of options. Default is empty array.
@type string $coerce_to Coerce the value to rem or px. Default `'rem'`.
@type int $root_size_value Value of root font size for rem|em <-> px conversion. Default `16`.
@type string[] $acceptable_units An array of font size units. Default `array( 'rem', 'px', 'em' )`;
}
Returns:- (array|null) An array consisting of `'value'` and `'unit'` properties on success.
`null` on failure.
Defined at: - Introduced in WordPress: 6.1.0
- Deprecated in WordPress: —
Description
Checks a string for a unit and value and returns an array
consisting of `'value'` and `'unit'`, e.g. array( '42', 'rem' ).