WP hooks navigation: Home/browse • Actions index • Filters index
To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).
The best way to understand what a hook does is to look at where it occurs in the source code.
do_action( "hook_name" )apply_filters( "hook_name", "what_to_filter" ).Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.
| Line | Code |
|---|---|
| 846 | return $this->error; |
| 847 | |
| 848 | set_current_user(0, $user_login); |
| 849 | if ( !current_user_can('upload_files') ) { |
| 850 | logIO('O', '(MW) User does not have upload_files capability'); |
| 851 | $this->error = new IXR_Error(401, 'You are not allowed to upload files to this site.'); |
| 852 | return $this->error; |
| 853 | } |
| 854 | |
| 855 | if ( $upload_err = apply_filters( "pre_upload_error", false ) ) |
| 856 | return new IXR_Error(500, $upload_err); |
| 857 | |
| 858 | $upload = wp_upload_bits($name, $type, $bits); |
| 859 | if ( ! empty($upload['error']) ) { |
| 860 | logIO('O', '(MW) Could not write file '.$name); |
| 861 | return new IXR_Error(500, 'Could not write file '.$name); |
| 862 | } |
| 863 | // Construct the attachment array |
| 864 | // attach to post_id -1 |