acf/validate_attachment/name=(name) хук-фильтрACF 5.2.3

Filters the errors for a file before it is uploaded or displayed in the media modal.

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

add_filter( 'acf/validate_attachment/name=(name)', 'wp_kama_acf_validate_attachment_name_filter', 10, 5 );

/**
 * Function for `acf/validate_attachment/name=(name)` filter-hook.
 * 
 * @param array  $errors     An array of errors.
 * @param array  $file       An array of data for a single file.
 * @param array  $attachment An array of attachment data which differs based on the context.
 * @param array  $field      The field array.
 * @param string $context    The curent context (uploading, preparing)
 *
 * @return array
 */
function wp_kama_acf_validate_attachment_name_filter( $errors, $file, $attachment, $field, $context ){

	// filter...
	return $errors;
}
$errors(массив)
An array of errors.
$file(массив)
An array of data for a single file.
$attachment(массив)
An array of attachment data which differs based on the context.
$field(массив)
The field array.
$context(строка)
The curent context (uploading, preparing)

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

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

Где вызывается хук

acf_validate_attachment()
acf/validate_attachment/name=(name)
acf/includes/api/api-helpers.php 3413
$errors = apply_filters( "acf/validate_attachment/name={$field['_name']}", $errors, $file, $attachment, $field, $context );

Где используется хук в Advanced Custom Fields PRO

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