Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: wp_create_file_in_uploads

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
563           $slug = "$slug.$ext";
564           $file = wp_upload_bits( $slug, NULL, $bits);
565
566           log_app('wp_upload_bits returns:',print_r($file,true));
567
568           $url = $file['url'];
569           $file = $file['file'];
570           $filename = basename($file);
571
572           $header = apply_filters('wp_create_file_in_uploads', $file); // replicate
573
574           // Construct the attachment array
575           $attachment = array(
576                'post_title' => $slug,
577                'post_content' => $slug,
578                'post_status' => 'attachment',
579                'post_parent' => 0,
580                'post_mime_type' => $type,
581                'guid' => $url