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 |
|---|---|
| 2601 | |
| 2602 | $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->posts WHERE ID = %d", $postid )); |
| 2603 | |
| 2604 | $uploadPath = wp_upload_dir(); |
| 2605 | |
| 2606 | if ( ! empty($meta['thumb']) ) { |
| 2607 | // Don't delete the thumb if another attachment uses it |
| 2608 | 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)) ) { |
| 2609 | $thumbfile = str_replace(basename($file), $meta['thumb'], $file); |
| 2610 | $thumbfile = apply_filters('wp_delete_file', $thumbfile); |
| 2611 | @ unlink( path_join($uploadPath['basedir'], $thumbfile) ); |
| 2612 | } |
| 2613 | } |
| 2614 | |
| 2615 | // remove intermediate images if there are any |
| 2616 | $sizes = apply_filters('intermediate_image_sizes', array('thumbnail', 'medium', 'large')); |
| 2617 | foreach ( $sizes as $size ) { |
| 2618 | if ( $intermediate = image_get_intermediate_size($postid, $size) ) { |
| 2619 | $intermediate_file = apply_filters('wp_delete_file', $intermediate['path']); |
| 2620 | @ unlink( path_join($uploadPath['basedir'], $intermediate_file) ); |
| 2621 | } |
| 2622 | } |
| 2623 | |
| 2624 | $file = apply_filters('wp_delete_file', $file); |
| 2625 | |
| 2626 | if ( ! empty($file) ) |
| 2627 | @ unlink($file); |
| 2628 | |
| 2629 | clean_post_cache($postid); |
| 2630 | |
| 2631 | return $post; |
| 2632 | } |
| 2633 | |