acf_get_meta_field()ACF 5.7.10

acf_get_meta_field

Returns a field using the provided $id and $post_id parameters. Looks for a reference to help loading the correct field via name.

Хуков нет.

Возвращает

(Массив|false). The field array.

Использование

acf_get_meta_field( $key, $post_id );
$key(строка)
The meta name (field name).
$post_id((int|string))
The post_id where this field's value is saved.

Список изменений

С версии 5.7.10 Введена.

Код acf_get_meta_field() ACF 6.0.4

function acf_get_meta_field( $key = 0, $post_id = 0 ) {

	// Try reference.
	$field_key = acf_get_reference( $key, $post_id );

	if ( $field_key ) {
		$field = acf_get_field( $field_key );
		if ( $field ) {
			$field['name'] = $key;
			return $field;
		}
	}

	// Return false.
	return false;
}