acf/upload_prefilter/type=(type)
Filters the errors for a file before it is uploaded to WordPress.
Usage
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(array)
- An array of errors.
- $file(array)
- An array of data for a single file.
- $field(array)
- The field array.
Changelog
| Since 5.1.5 | Introduced. |
Where the hook is called
acf/upload_prefilter/type=(type)
acf/includes/media.php 119
$errors = apply_filters( "acf/upload_prefilter/type={$field['type']}", $errors, $file, $field );