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 |
|---|---|
| 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 | |
| 1249 | $wp_rewrite->flush_rules(false); |
| 1250 | } else { |
| 1251 | clean_post_cache($postid); |
| 1252 | } |
| 1253 | |
| 1254 | wp_clear_scheduled_hook('publish_future_post', $postid); |
| 1255 | |
| 1256 | do_action('deleted_post', $postid); |
| 1257 | |
| 1258 | return $post; |
| 1259 | } |
| 1260 | |
| 1261 | /** |
| 1262 | * Moves a post or page to the Trash |
| 1263 | * |
| 1264 | * @since 2.9.0 |
| 1265 | * @uses do_action() on 'trash_post' before trashing |
| Line | Code |
| 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); |
| 2885 | $thumbfile = apply_filters('wp_delete_file', $thumbfile); |
| 2886 | @ unlink( path_join($uploadpath['basedir'], $thumbfile) ); |