ACF\Meta

MetaLocation::get_referencepublicACF 6.4

Gets a reference key for the provided field name.

Метод класса: MetaLocation{}

Хуков нет.

Возвращает

Строку|null.

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

$MetaLocation = new MetaLocation();
$MetaLocation->get_reference( $object_id, $field_name );
$object_id(int|строка)
The ID of the object to get the reference key from.
$field_name(строка)
The name of the field to get the reference for.
По умолчанию: ''

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

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

Код MetaLocation::get_reference() ACF 6.4.2

public function get_reference( $object_id = 0, $field_name = '' ) {
	$reference = get_metadata( $this->location_type, $object_id, $this->reference_prefix . $field_name );
	return $reference[0] ?? null;
}