acf_maybe_get()ACF 5.1.5

acf_maybe_get

This function will return a var if it exists in an array

No Hooks.

Returns

$post_id. (int)

Usage

acf_maybe_get( $array, $key, $default );
$array
.
Default: array()
$key
.
$default
.
Default: null

Changelog

Since 5.1.5 Introduced.

acf_maybe_get() code ACF 6.8.8

function acf_maybe_get( $array = array(), $key = 0, $default = null ) {

	return isset( $array[ $key ] ) ? $array[ $key ] : $default;
}