Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: pre_upload_error

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

Line Code
6357            * Filters whether to preempt the XML-RPC media upload.
6358            *
6359            * Passing a truthy value will effectively short-circuit the media upload,
6360            * returning that value as a 500 error instead.
6361            *
6362            * @since 2.1.0
6363            *
6364            * @param bool $error Whether to pre-empt the media upload. Default false.
6365            */
6366           $upload_err = apply_filters( 'pre_upload_error', false );
6367           if ( $upload_err ) {
6368                return new IXR_Error( 500, $upload_err );
6369           }
6370
6371           $upload = wp_upload_bits( $name, null, $bits );
6372           if ( ! empty( $upload['error'] ) ) {
6373                /* translators: 1: File name, 2: Error message. */
6374                $errorString = sprintf( __( 'Could not write file %1$s (%2$s).' ), $name, $upload['error'] );
6375                return new IXR_Error( 500, $errorString );