acf_validate_is_image_attachment_basic_upload()
Validates image attachment data during basic uploader pre-save checks.
Хуков нет.
Возвращает
array.
Использование
acf_validate_is_image_attachment_basic_upload( $errors, $file, $attachment, $field, $context, $error_message );
- $errors(массив) (обязательный)
- Validation errors.
- $file(массив) (обязательный)
- Normalized file data.
- $attachment(массив) (обязательный)
- Raw attachment data for the current context.
- $field(массив) (обязательный)
- The field array.
- $context(строка) (обязательный)
- The validation context.
- $error_message(строка) (обязательный)
- The error message to use when validation fails.
Список изменений
| С версии 6.8.7 | Введена. |
Код acf_validate_is_image_attachment_basic_upload() acf validate is image attachment basic upload ACF 6.8.8
function acf_validate_is_image_attachment_basic_upload( $errors, $file, $attachment, $field, $context, $error_message ) {
$mime = acf_maybe_get( $attachment, 'type', '' );
if ( $mime && empty( wp_match_mime_types( 'image', $mime ) ) ) {
$errors['invalid_image'] = $error_message;
}
return acf_apply_validate_is_image_attachment_filters( $errors, $file, $attachment, $field, $context );
}