Filter hook 'wp_upload_bits'

in WP Core File wp-includes/functions.php at line 2919

View Source

wp_upload_bits

Filter Hook
Description
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.

Hook Information

File Location wp-includes/functions.php View on GitHub
Hook Type Filter
Line Number 2919

Hook Parameters

Type Name Description
array|string $upload_bits_error An array of upload bits data, or error message to return.

Usage Examples

Basic Usage
<?php
// Hook into wp_upload_bits
add_filter('wp_upload_bits', 'my_custom_filter', 10, 1);

function my_custom_filter($upload_bits_error) {
    // Your custom filtering logic here
    return $upload_bits_error;
}

Source Code Context

wp-includes/functions.php:2919 - How this hook is used in WordPress core
<?php
2914  	 *
2915  	 * @since 3.0.0
2916  	 *
2917  	 * @param array|string $upload_bits_error An array of upload bits data, or error message to return.
2918  	 */
2919  	$upload_bits_error = apply_filters(
2920  		'wp_upload_bits',
2921  		array(
2922  			'name' => $name,
2923  			'bits' => $bits,
2924  			'time' => $time,

PHP Documentation

<?php
/**
	 * 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.
	 *
	 * @since 3.0.0
	 *
	 * @param array|string $upload_bits_error An array of upload bits data, or error message to return.
	 */
Quick Info
  • Hook Type: Filter
  • Parameters: 1
  • File: wp-includes/functions.php
Related Hooks

Related hooks will be displayed here in future updates.