pre_upload_error
Filter HookDescription
Filters whether to preempt the XML-RPC media upload. Returning a truthy value will effectively short-circuit the media upload, returning that value as a 500 error instead.Hook Information
File Location |
wp-includes/class-wp-xmlrpc-server.php
View on GitHub
|
Hook Type | Filter |
Line Number | 6490 |
Hook Parameters
Type | Name | Description |
---|---|---|
bool
|
$error
|
Whether to pre-empt the media upload. Default false. |
Usage Examples
Basic Usage
<?php
// Hook into pre_upload_error
add_filter('pre_upload_error', 'my_custom_filter', 10, 1);
function my_custom_filter($error) {
// Your custom filtering logic here
return $error;
}
Source Code Context
wp-includes/class-wp-xmlrpc-server.php:6490
- How this hook is used in WordPress core
<?php
6485 *
6486 * @since 2.1.0
6487 *
6488 * @param bool $error Whether to pre-empt the media upload. Default false.
6489 */
6490 $upload_err = apply_filters( 'pre_upload_error', false );
6491 if ( $upload_err ) {
6492 return new IXR_Error( 500, $upload_err );
6493 }
6494
6495 $upload = wp_upload_bits( $name, null, $bits );
PHP Documentation
<?php
/**
* Filters whether to preempt the XML-RPC media upload.
*
* Returning a truthy value will effectively short-circuit the media upload,
* returning that value as a 500 error instead.
*
* @since 2.1.0
*
* @param bool $error Whether to pre-empt the media upload. Default false.
*/
Quick Info
- Hook Type: Filter
- Parameters: 1
- File: wp-includes/class-wp-xmlrpc-server.php
Related Hooks
Related hooks will be displayed here in future updates.