wp_is_explicit_aspect_ratio_value()WP 7.1.0

Checks whether an aspectRatio block-support value is explicitly set.

Internal function — this function is designed to be used by the kernel itself. It is not recommended to use this function in your code.

No Hooks.

Returns

bool. Whether the value is an explicit aspect ratio.

Usage

wp_is_explicit_aspect_ratio_value( $aspect_ratio );
$aspect_ratio(mixed) (required)
Aspect-ratio value.

Changelog

Since 7.1.0 Introduced.

wp_is_explicit_aspect_ratio_value() code WP 7.1

function wp_is_explicit_aspect_ratio_value( $aspect_ratio ) {
	if ( ! is_string( $aspect_ratio ) && ! is_numeric( $aspect_ratio ) ) {
		return false;
	}

	$aspect_ratio = strtolower( trim( (string) $aspect_ratio ) );

	return '' !== $aspect_ratio && 'auto' !== $aspect_ratio;
}