WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

acf_delete_field_group() ACF 5.7.10

Deletes a field group from the database.

Хуки из функции
Возвращает

true/false. True if field group was deleted.

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

acf_delete_field_group( $id );
$id((число/строка))
The field group ID, key or name.
По умолчанию: 0

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

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

Код acf_delete_field_group() ACF 5.9.1

<?php
function acf_delete_field_group( $id = 0 ) {
	
	// Disable filters to ensure ACF loads data from DB.
	acf_disable_filters();
	
	// Get the field_group.
	$field_group = acf_get_field_group( $id );
	
	// Bail early if field group was not found.
	if( !$field_group || !$field_group['ID'] ) {
		return false;
	}
	
	// Delete fields.
	$fields = acf_get_fields( $field_group );
	if( $fields ) {
		foreach( $fields as $field ) {
			acf_delete_field( $field['ID'] );
		}
	}
	
	// Delete post.
	wp_delete_post( $field_group['ID'], true );
	
	// Flush field group cache.
	acf_flush_field_group_cache( $field_group );
	
	/**
	 * Fires immediately after a field group has been deleted.
	 *
	 * @date	12/02/2014
	 * @since	5.0.0
	 *
	 * @param	array $field_group The field group array.
	 */
	do_action( 'acf/delete_field_group', $field_group );
	
	// Return true.
	return true;
}