apply_filters( "{$action}_overrides", array|false $overrides, array $file )
- Since
- 5.7.0
Filters the override parameters for a file before it is uploaded to WordPress.
Description
The dynamic portion of the hook name, $action, refers to the post action.
Possible hook names include:
wp_handle_sideload_overrideswp_handle_upload_overrides
Compatibility
- WordPress
- since 5.7.0
- 6.7.7
- 6.8.8
- 6.9.7
- 7.0.4
- 7.1.0
Present in every tracked release (6.7.7 to 7.1.0).
Parameters
$overridesarray|false- An array of override parameters for this file. Boolean false if none are provided. See _wp_handle_upload().
$filearray- { Reference to a single element from
$_FILES.
@type string $name The original name of the file on the client machine.
@type string $type The mime type of the file, if the browser provided this information.
@type string $tmp_name The temporary filename of the file in which the uploaded file was stored on the server.
@type int $size The size, in bytes, of the uploaded file.
@type int $error The error code associated with this file upload.
}$namestringThe original name of the file on the client machine.$typestringThe mime type of the file, if the browser provided this information.$tmp_namestringThe temporary filename of the file in which the uploaded file was stored on the server.$sizeintThe size, in bytes, of the uploaded file.$errorintThe error code associated with this file upload.
Where this hook fires · 1
wp-admin/includes/file.php:861_wp_handle_upload()
Source code
* @type string $type The mime type of the file, if the browser provided this information. * @type string $tmp_name The temporary filename of the file in which the uploaded file was stored on the server. * @type int $size The size, in bytes, of the uploaded file. * @type int $error The error code associated with this file upload. * } */ $overrides = apply_filters( "{$action}_overrides", $overrides, $file ); // You may define your own function and pass the name in $overrides['upload_error_handler']. $upload_error_handler = 'wp_handle_upload_error'; if ( isset( $overrides['upload_error_handler'] ) ) { $upload_error_handler = $overrides['upload_error_handler']; }Changelog
Introduced in 5.7.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
About this page
- Parsed data
- Generated from the wordpress-develop 7.0.4 tag, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
- Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.