acf_get_raw_field_group()ACF 5.7.10

acf_get_raw_field_group

Retrieves raw field group data for the given identifier.

Хуков нет.

Возвращает

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

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

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

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

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

Код acf_get_raw_field_group() ACF 6.0.4

function acf_get_raw_field_group( $id = 0 ) {

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

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

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

	// update attributes
	$field_group['ID']         = $post->ID;
	$field_group['title']      = $post->post_title;
	$field_group['key']        = $post->post_name;
	$field_group['menu_order'] = $post->menu_order;
	$field_group['active']     = in_array( $post->post_status, array( 'publish', 'auto-draft' ) );

	// Return field.
	return $field_group;
}