wp_handle_sideload_overrides
Filters the override parameters for a file before it is uploaded to WordPress.
Это один из вариантов динамического хука (action)_overrides
Использование
add_filter( 'wp_handle_sideload_overrides', 'wp_kama_handle_sideload_overrides_filter', 10, 2 ); /** * Function for `wp_handle_sideload_overrides` filter-hook. * * @param array|false $overrides An array of override parameters for this file. Boolean false if none are provided. See {@see _wp_handle_upload()}. * @param array $file Reference to a single element from `$_FILES`. * * @return array|false */ function wp_kama_handle_sideload_overrides_filter( $overrides, $file ){ // filter... return $overrides; }
- $overrides(массив|false)
- An array of override parameters for this file. Boolean false if none are provided. See {@see _wp_handle_upload()}.
- $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.
-
Список изменений
С версии 5.7.0 | Введена. |
Где вызывается хук
wp_handle_sideload_overrides
wp-admin/includes/file.php 859
$overrides = apply_filters( "{$action}_overrides", $overrides, $file );