wp_handle_upload_overrides filter-hookWP 5.7.0

Filters the override parameters for a file before it is uploaded to WordPress.

This is one of the variants of the dynamic hook (action)_overrides

Usage

add_filter( 'wp_handle_upload_overrides', 'wp_kama_handle_upload_overrides_filter', 10, 2 );

/**
 * Function for `wp_handle_upload_overrides` filter-hook.
 * 
 * @param array|false $overrides An array of override parameters for this file. Boolean false if none are provided. @see _wp_handle_upload().
 * @param array       $file      Reference to a single element from `$_FILES`.
 *
 * @return array|false
 */
function wp_kama_handle_upload_overrides_filter( $overrides, $file ){

	// filter...
	return $overrides;
}
$overrides(array|false)
An array of override parameters for this file. Boolean false if none are provided. @see _wp_handle_upload().
$file(array)

Reference to a single element from $_FILES.

  • name(string)
    The original name of the file on the client machine.

  • type(string)
    The mime type of the file, if the browser provided this information.

  • tmp_name(string)
    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.

Changelog

Since 5.7.0 Introduced.

Where the hook is called

_wp_handle_upload()
wp_handle_upload_overrides
wp-admin/includes/file.php 828
$overrides = apply_filters( "{$action}_overrides", $overrides, $file );

Where the hook is used in WordPress

Usage not found.