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 2 times in this file.
| Line | Code |
|---|---|
| 1987 | // Use wp_delete_post (via wp_delete_post_revision) again. Ensures any meta/misplaced data gets cleaned up. |
| 1988 | foreach ( $revision_ids as $revision_id ) |
| 1989 | wp_delete_post_revision( $revision_id ); |
| 1990 | |
| 1991 | // Point all attachments to this post up one level |
| 1992 | $wpdb->update( $wpdb->posts, $parent_data, $parent_where + array( 'post_type' => 'attachment' ) ); |
| 1993 | |
| 1994 | $comment_ids = $wpdb->get_col( $wpdb->prepare( "SELECT comment_ID FROM $wpdb->comments WHERE comment_post_ID = %d", $postid )); |
| 1995 | if ( ! empty($comment_ids) ) { |
| 1996 | do_action( 'delete_comment', $comment_ids ); |
| 1997 | foreach ( $comment_ids as $comment_id ) |
| 1998 | wp_delete_comment( $comment_id, true ); |
| 1999 | do_action( 'deleted_comment', $comment_ids ); |
| 2000 | } |
| 2001 | |
| 2002 | $post_meta_ids = $wpdb->get_col( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE post_id = %d ", $postid )); |
| 2003 | if ( !empty($post_meta_ids) ) { |
| 2004 | do_action( 'delete_postmeta', $post_meta_ids ); |
| 2005 | $in_post_meta_ids = "'" . implode("', '", $post_meta_ids) . "'"; |
| Line | Code |
| 3700 | do_action('delete_attachment', $post_id); |
| 3701 | |
| 3702 | wp_delete_object_term_relationships($post_id, array('category', 'post_tag')); |
| 3703 | wp_delete_object_term_relationships($post_id, get_object_taxonomies($post->post_type)); |
| 3704 | |
| 3705 | $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->postmeta WHERE meta_key = '_thumbnail_id' AND meta_value = %d", $post_id )); |
| 3706 | |
| 3707 | $comment_ids = $wpdb->get_col( $wpdb->prepare( "SELECT comment_ID FROM $wpdb->comments WHERE comment_post_ID = %d", $post_id )); |
| 3708 | if ( ! empty( $comment_ids ) ) { |
| 3709 | do_action( 'delete_comment', $comment_ids ); |
| 3710 | foreach ( $comment_ids as $comment_id ) |
| 3711 | wp_delete_comment( $comment_id, true ); |
| 3712 | do_action( 'deleted_comment', $comment_ids ); |
| 3713 | } |
| 3714 | |
| 3715 | $post_meta_ids = $wpdb->get_col( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE post_id = %d ", $post_id )); |
| 3716 | if ( !empty($post_meta_ids) ) { |
| 3717 | do_action( 'delete_postmeta', $post_meta_ids ); |
| 3718 | $in_post_meta_ids = "'" . implode("', '", $post_meta_ids) . "'"; |