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 |
|---|---|
| 1175 | if ( !$post = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->posts WHERE ID = %d", $postid)) ) |
| 1176 | return $post; |
| 1177 | |
| 1178 | if ( !$force_delete && ( $post->post_type == 'post' || $post->post_type == 'page') && get_post_status( $postid ) != 'trash' && EMPTY_TRASH_DAYS > 0 ) |
| 1179 | return wp_trash_post($postid); |
| 1180 | |
| 1181 | if ( $post->post_type == 'attachment' ) |
| 1182 | return wp_delete_attachment( $postid, $force_delete ); |
| 1183 | |
| 1184 | do_action('delete_post', $postid); |
| 1185 | |
| 1186 | delete_post_meta($postid,'_wp_trash_meta_status'); |
| 1187 | delete_post_meta($postid,'_wp_trash_meta_time'); |
| 1188 | |
| 1189 | wp_delete_object_term_relationships($postid, get_object_taxonomies($post->post_type)); |
| 1190 | |
| 1191 | $parent_data = array( 'post_parent' => $post->post_parent ); |
| 1192 | $parent_where = array( 'post_parent' => $postid ); |
| 1193 | |
| Line | Code |
| 1230 | |
| 1231 | $post_meta_ids = $wpdb->get_col( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE post_id = %d ", $postid )); |
| 1232 | if ( !empty($post_meta_ids) ) { |
| 1233 | do_action( 'delete_postmeta', $post_meta_ids ); |
| 1234 | $in_post_meta_ids = "'" . implode("', '", $post_meta_ids) . "'"; |
| 1235 | $wpdb->query( "DELETE FROM $wpdb->postmeta WHERE meta_id IN($in_post_meta_ids)" ); |
| 1236 | do_action( 'deleted_postmeta', $post_meta_ids ); |
| 1237 | } |
| 1238 | |
| 1239 | do_action( 'delete_post', $postid ); |
| 1240 | $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->posts WHERE ID = %d", $postid )); |
| 1241 | do_action( 'deleted_post', $postid ); |
| 1242 | |
| 1243 | if ( 'page' == $post->post_type ) { |
| 1244 | clean_page_cache($postid); |
| 1245 | |
| 1246 | foreach ( (array) $children as $child ) |
| 1247 | clean_page_cache($child->ID); |
| 1248 | |
| Line | Code |
| 2866 | |
| 2867 | $post_meta_ids = $wpdb->get_col( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE post_id = %d ", $post_id )); |
| 2868 | if ( !empty($post_meta_ids) ) { |
| 2869 | do_action( 'delete_postmeta', $post_meta_ids ); |
| 2870 | $in_post_meta_ids = "'" . implode("', '", $post_meta_ids) . "'"; |
| 2871 | $wpdb->query( "DELETE FROM $wpdb->postmeta WHERE meta_id IN($in_post_meta_ids)" ); |
| 2872 | do_action( 'deleted_postmeta', $post_meta_ids ); |
| 2873 | } |
| 2874 | |
| 2875 | do_action( 'delete_post', $post_id ); |
| 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); |