acf/validate_attachment/key=(key) хук-фильтр . 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/key=(key)', 'filter_function_name_4339', 10, 5 ); function filter_function_name_4339( $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/key=(key)
acf/includes/api/api-helpers.php 3700
$errors = apply_filters( "acf/validate_attachment/key={$field['key']}", $errors, $file, $attachment, $field, $context );