acf_get_raw_field()ACF 5.7.10

acf_get_raw_field

Retrieves raw field data for the given identifier.

Хуков нет.

Возвращает

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

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

acf_get_raw_field( $id );
$id((int|string))
The field ID, key or name.

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

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

Код acf_get_raw_field() ACF 5.10.2

function acf_get_raw_field( $id = 0 ) {

	// Get raw field from database.
	$post = acf_get_field_post( $id );
	if ( ! $post ) {
		return false;
	}

	// Bail early if incorrect post type.
	if ( $post->post_type !== 'acf-field' ) {
		return false;
	}

	// Unserialize post_content.
	$field = (array) maybe_unserialize( $post->post_content );

	// update attributes
	$field['ID']         = $post->ID;
	$field['key']        = $post->post_name;
	$field['label']      = $post->post_title;
	$field['name']       = $post->post_excerpt;
	$field['menu_order'] = $post->menu_order;
	$field['parent']     = $post->post_parent;

	// Return field.
	return $field;
}