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 |
|---|---|
| 4915 | do_action( 'deleted_post', $post_id ); |
| 4916 | |
| 4917 | $uploadpath = wp_get_upload_dir(); |
| 4918 | |
| 4919 | if ( ! empty($meta['thumb']) ) { |
| 4920 | // Don't delete the thumb if another attachment uses it. |
| 4921 | 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", '%' . $wpdb->esc_like( $meta['thumb'] ) . '%', $post_id)) ) { |
| 4922 | $thumbfile = str_replace(basename($file), $meta['thumb'], $file); |
| 4923 | /** This filter is documented in wp-includes/functions.php */ |
| 4924 | $thumbfile = apply_filters( 'wp_delete_file', $thumbfile ); |
| 4925 | @ unlink( path_join($uploadpath['basedir'], $thumbfile) ); |
| 4926 | } |
| 4927 | } |
| 4928 | |
| 4929 | // Remove intermediate and backup images if there are any. |
| 4930 | if ( isset( $meta['sizes'] ) && is_array( $meta['sizes'] ) ) { |
| 4931 | foreach ( $meta['sizes'] as $size => $sizeinfo ) { |
| 4932 | $intermediate_file = str_replace( basename( $file ), $sizeinfo['file'], $file ); |
| 4933 | /** This filter is documented in wp-includes/functions.php */ |
| 4934 | $intermediate_file = apply_filters( 'wp_delete_file', $intermediate_file ); |
| 4935 | @ unlink( path_join( $uploadpath['basedir'], $intermediate_file ) ); |
| 4936 | } |
| 4937 | } |
| 4938 | |
| 4939 | if ( is_array($backup_sizes) ) { |
| 4940 | foreach ( $backup_sizes as $size ) { |
| 4941 | $del_file = path_join( dirname($meta['file']), $size['file'] ); |
| 4942 | /** This filter is documented in wp-includes/functions.php */ |
| 4943 | $del_file = apply_filters( 'wp_delete_file', $del_file ); |
| 4944 | @ unlink( path_join($uploadpath['basedir'], $del_file) ); |
| 4945 | } |
| 4946 | } |
| 4947 | |
| 4948 | wp_delete_file( $file ); |
| 4949 | |
| 4950 | clean_post_cache( $post ); |
| 4951 | |
| 4952 | return $post; |