wp_upload_bits filter-hookWP 3.0.0

Filters whether to treat the upload bits as an error.

Returning a non-array from the filter will effectively short-circuit preparing the upload bits and return that value instead. An error message should be returned as a string.

Usage

add_filter( 'wp_upload_bits', 'wp_kama_upload_bits_filter' );

/**
 * Function for `wp_upload_bits` filter-hook.
 * 
 * @param array|string $upload_bits_error An array of upload bits data, or error message to return.
 *
 * @return array|string
 */
function wp_kama_upload_bits_filter( $upload_bits_error ){

	// filter...
	return $upload_bits_error;
}
$upload_bits_error(array|string)
An array of upload bits data, or error message to return.

Changelog

Since 3.0.0 Introduced.

Where the hook is called

wp_upload_bits()
wp_upload_bits
wp-includes/functions.php 2889-2896
$upload_bits_error = apply_filters(
	'wp_upload_bits',
	array(
		'name' => $name,
		'bits' => $bits,
		'time' => $time,
	)
);

Where the hook is used in WordPress

wp-includes/ms-default-filters.php 101
add_filter( 'wp_upload_bits', 'upload_is_file_too_big' );