acf_parse_type()ACF 5.0.9

acf_parse_type

description

No Hooks.

Returns

$post_id. (int)

Usage

acf_parse_type( $v );
$v(required)
.

Changelog

Since 5.0.9 Introduced.

acf_parse_type() code ACF 6.8.8

function acf_parse_type( $v ) {

	// Check if is string.
	if ( is_string( $v ) ) {

		// Trim ("Word " = "Word").
		$v = trim( $v );

		// Convert int strings to int ("123" = 123).
		if ( is_numeric( $v ) && strval( intval( $v ) ) === $v ) {
			$v = intval( $v );
		}
	}

	// return.
	return $v;
}