acf_get_meta_instance()ACF 6.4

Retrieves an ACF meta instance for the provided meta type.

Хуков нет.

Возвращает

Объект|null.

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

acf_get_meta_instance( $type ): ?object;
$type(строка) (обязательный)
The meta type as decoded from the post ID.

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

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

Код acf_get_meta_instance() ACF 6.4.2

function acf_get_meta_instance( string $type ): ?object {
	$instance       = null;
	$meta_locations = acf_get_store( 'acf-meta-locations' );

	if ( $meta_locations && $meta_locations->has( $type ) ) {
		$instance = acf_get_instance( $meta_locations->get( $type ) );
	}

	return $instance;
}