acf/upload_prefilter/type=(type) хук-фильтрACF 5.1.5

Filters the errors for a file before it is uploaded to WordPress.

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

add_filter( 'acf/upload_prefilter/type=(type)', 'wp_kama_acf_upload_prefilter_type_filter', 10, 3 );

/**
 * Function for `acf/upload_prefilter/type=(type)` filter-hook.
 * 
 * @param array $errors An array of errors.
 * @param array $file   An array of data for a single file.
 * @param array $field  The field array.
 *
 * @return array
 */
function wp_kama_acf_upload_prefilter_type_filter( $errors, $file, $field ){

	// filter...
	return $errors;
}
$errors(массив)
An array of errors.
$file(массив)
An array of data for a single file.
$field(массив)
The field array.

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

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

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

ACF_Media::handle_upload_prefilter()
acf/upload_prefilter/type=(type)
acf/includes/media.php 110
$errors = apply_filters( "acf/upload_prefilter/type={$field['type']}", $errors, $file, $field );

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

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