(action)_prefilter
Filters the data for a file before it is uploaded to WordPress.
The dynamic portion of the hook name, $action, refers to the post action.
Possible hook names include:
Использование
add_filter( '(action)_prefilter', 'wp_kama_action_prefilter' );
/**
* Function for `(action)_prefilter` filter-hook.
*
* @param array $file Reference to a single element from `$_FILES`.
*
* @return array
*/
function wp_kama_action_prefilter( $file ){
// filter...
return $file;
}
- $file(массив)
Reference to a single element from
$_FILES.-
name(строка)
The original name of the file on the client machine. -
type(строка)
The mime type of the file, if the browser provided this information. -
tmp_name(строка)
The temporary filename of the file in which the uploaded file was stored on the server. -
size(int)
The size, in bytes, of the uploaded file. - error(int)
The error code associated with this file upload.
-
Список изменений
| С версии 2.9.0 | Введена. |
| С версии 2.9.0 | as wp_handle_upload_prefilter. |
| С версии 4.0.0 | Converted to a dynamic hook with $action. |
Где вызывается хук
(action)_prefilter
wp-admin/includes/file.php 840
$file = apply_filters( "{$action}_prefilter", $file );
Где используется хук в WordPress
wp-admin/includes/ms-admin-filters.php 11
add_filter( 'wp_handle_upload_prefilter', 'check_upload_size' );