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.
This hook occurs 3 times in this file.
Line | Code |
---|---|
2304 |
|
2305 | $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->comments WHERE comment_post_ID = %d", $postid )); |
2306 |
|
2307 | $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->postmeta WHERE post_id = %d ", $postid )); |
2308 |
|
2309 | if ( ! empty($meta['thumb']) ) { |
2310 | // Don't delete the thumb if another attachment uses it |
2311 | if (! $wpdb->get_row( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE meta_key = '_wp_attachment_metadata' AND meta_value LIKE %s AND post_id <> %d", '%'.$meta['thumb'].'%', $postid)) ) { |
2312 | $thumbfile = str_replace(basename($file), $meta['thumb'], $file); |
2313 | $thumbfile = apply_filters('wp_delete_file', $thumbfile); |
2314 | @ unlink($thumbfile); |
2315 | } |
2316 | } |
2317 |
|
2318 | // remove intermediate images if there are any |
2319 | $sizes = apply_filters('intermediate_image_sizes', array('thumbnail', 'medium')); |
2320 | foreach ( $sizes as $size ) { |
2321 | if ( $intermediate = image_get_intermediate_size($postid, $size) ) { |
2322 | $intermediate_file = apply_filters('wp_delete_file', $intermediate['path']); |
2323 | @ unlink($intermediate_file); |
2324 | } |
2325 | } |
2326 |
|
2327 | $file = apply_filters('wp_delete_file', $file); |
2328 |
|
2329 | if ( ! empty($file) ) |
2330 | @ unlink($file); |
2331 |
|
2332 | clean_post_cache($postid); |
2333 |
|
2334 | do_action('delete_attachment', $postid); |
2335 |
|
2336 | return $post; |