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 |
|---|---|
| 4677 | do_action( 'deleted_post', $post_id ); |
| 4678 | |
| 4679 | $uploadpath = wp_upload_dir(); |
| 4680 | |
| 4681 | if ( ! empty($meta['thumb']) ) { |
| 4682 | // Don't delete the thumb if another attachment uses it |
| 4683 | 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)) ) { |
| 4684 | $thumbfile = str_replace(basename($file), $meta['thumb'], $file); |
| 4685 | /** This filter is documented in wp-admin/custom-header.php */ |
| 4686 | $thumbfile = apply_filters( 'wp_delete_file', $thumbfile ); |
| 4687 | @ unlink( path_join($uploadpath['basedir'], $thumbfile) ); |
| 4688 | } |
| 4689 | } |
| 4690 | |
| 4691 | // remove intermediate and backup images if there are any |
| 4692 | foreach ( $intermediate_sizes as $intermediate ) { |
| 4693 | /** This filter is documented in wp-admin/custom-header.php */ |
| 4694 | $intermediate_file = apply_filters( 'wp_delete_file', $intermediate['path'] ); |
| 4695 | @ unlink( path_join($uploadpath['basedir'], $intermediate_file) ); |
| 4696 | } |
| 4697 | |
| 4698 | if ( is_array($backup_sizes) ) { |
| 4699 | foreach ( $backup_sizes as $size ) { |
| 4700 | $del_file = path_join( dirname($meta['file']), $size['file'] ); |
| 4701 | /** This filter is documented in wp-admin/custom-header.php */ |
| 4702 | $del_file = apply_filters( 'wp_delete_file', $del_file ); |
| 4703 | @ unlink( path_join($uploadpath['basedir'], $del_file) ); |
| 4704 | } |
| 4705 | } |
| 4706 | |
| 4707 | /** This filter is documented in wp-admin/custom-header.php */ |
| 4708 | $file = apply_filters( 'wp_delete_file', $file ); |
| 4709 | |
| 4710 | if ( ! empty($file) ) |
| 4711 | @ unlink($file); |
| 4712 | |
| 4713 | clean_post_cache( $post ); |
| 4714 | |
| 4715 | return $post; |
| 4716 | } |
| 4717 | |