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 |
---|---|
537 | elseif ( empty( $slug ) ) // just make a random name |
538 | $slug = substr( md5( uniqid( microtime() ) ), 0, 7); |
539 | $ext = preg_replace( '|.*/([a-z0-9]+)|', '$1', $_SERVER['CONTENT_TYPE'] ); |
540 | $slug = sanitize_file_name( "$slug.$ext" ); |
541 | $file = wp_upload_bits( $slug, null, $bits); |
542 |
|
543 | $url = $file['url']; |
544 | $file = $file['file']; |
545 |
|
546 | do_action('wp_create_file_in_uploads', $file); // replicate |
547 |
|
548 | // Construct the attachment array |
549 | $attachment = array( |
550 | 'post_title' => $slug, |
551 | 'post_content' => $slug, |
552 | 'post_status' => 'attachment', |
553 | 'post_parent' => 0, |
554 | 'post_mime_type' => $type, |
555 | 'guid' => $url |