wp_upload_bits хук-фильтрWP 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.

Использование

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(массив|строка)
An array of upload bits data, or error message to return.

Список изменений

С версии 3.0.0 Введена.

Где вызывается хук

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

Где используется хук в WordPress

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