pre_upload_error filter-hookWP 2.1.0

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.

Usage

add_filter( 'pre_upload_error', 'wp_kama_pre_upload_error_filter' );

/**
 * Function for `pre_upload_error` filter-hook.
 * 
 * @param bool $error Whether to pre-empt the media upload.
 *
 * @return bool
 */
function wp_kama_pre_upload_error_filter( $error ){

	// filter...
	return $error;
}
$error(true|false)
Whether to pre-empt the media upload.
Default: false

Changelog

Since 2.1.0 Introduced.

Where the hook is called

wp_xmlrpc_server::mw_newMediaObject()
pre_upload_error
wp-includes/class-wp-xmlrpc-server.php 6428
$upload_err = apply_filters( 'pre_upload_error', false );

Where the hook is used in WordPress

Usage not found.