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 4 times in this file.
| Line | Code |
|---|---|
| 2876 | $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->posts WHERE ID = %d", $post_id )); |
| 2877 | do_action( 'deleted_post', $post_id ); |
| 2878 | |
| 2879 | $uploadpath = wp_upload_dir(); |
| 2880 | |
| 2881 | if ( ! empty($meta['thumb']) ) { |
| 2882 | // Don't delete the thumb if another attachment uses it |
| 2883 | 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'] . '%', $post_id)) ) { |
| 2884 | $thumbfile = str_replace(basename($file), $meta['thumb'], $file); |
| 2885 | $thumbfile = apply_filters('wp_delete_file', $thumbfile); |
| 2886 | @ unlink( path_join($uploadpath['basedir'], $thumbfile) ); |
| 2887 | } |
| 2888 | } |
| 2889 | |
| 2890 | // remove intermediate and backup images if there are any |
| 2891 | $sizes = apply_filters('intermediate_image_sizes', array('thumbnail', 'medium', 'large')); |
| 2892 | foreach ( $sizes as $size ) { |
| 2893 | if ( $intermediate = image_get_intermediate_size($post_id, $size) ) { |
| 2894 | $intermediate_file = apply_filters('wp_delete_file', $intermediate['path']); |
| 2895 | @ unlink( path_join($uploadpath['basedir'], $intermediate_file) ); |
| 2896 | } |
| 2897 | } |
| 2898 | |
| 2899 | if ( is_array($backup_sizes) ) { |
| 2900 | foreach ( $backup_sizes as $size ) { |
| 2901 | $del_file = path_join( dirname($meta['file']), $size['file'] ); |
| 2902 | $del_file = apply_filters('wp_delete_file', $del_file); |
| 2903 | @ unlink( path_join($uploadpath['basedir'], $del_file) ); |
| 2904 | } |
| 2905 | } |
| 2906 | |
| 2907 | $file = apply_filters('wp_delete_file', $file); |
| 2908 | |
| 2909 | if ( ! empty($file) ) |
| 2910 | @ unlink($file); |
| 2911 | |
| 2912 | clean_post_cache($post_id); |
| 2913 | |
| 2914 | return $post; |
| 2915 | } |
| 2916 | |