Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: delete_comment

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

This hook occurs 2 times in this file.

Line Code
1760      // Use wp_delete_post (via wp_delete_post_revision) again.  Ensures any meta/misplaced data gets cleaned up.
1761      foreach ( $revision_ids as $revision_id )
1762           wp_delete_post_revision( $revision_id );
1763
1764      // Point all attachments to this post up one level
1765      $wpdb->update( $wpdb->posts, $parent_data, $parent_where + array( 'post_type' => 'attachment' ) );
1766
1767      $comment_ids = $wpdb->get_col( $wpdb->prepare( "SELECT comment_ID FROM $wpdb->comments WHERE comment_post_ID = %d", $postid ));
1768      if ( ! empty($comment_ids) ) {
1769           do_action( 'delete_comment', $comment_ids );
1770           foreach ( $comment_ids as $comment_id )
1771                wp_delete_comment( $comment_id, true );
1772           do_action( 'deleted_comment', $comment_ids );
1773      }
1774
1775      $post_meta_ids = $wpdb->get_col( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE post_id = %d ", $postid ));
1776      if ( !empty($post_meta_ids) ) {
1777           do_action( 'delete_postmeta', $post_meta_ids );
1778           $in_post_meta_ids = "'" . implode("', '", $post_meta_ids) . "'";
 
Line Code
3458      do_action('delete_attachment', $post_id);
3459
3460      wp_delete_object_term_relationships($post_id, array('category', 'post_tag'));
3461      wp_delete_object_term_relationships($post_id, get_object_taxonomies($post->post_type));
3462
3463      $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->postmeta WHERE meta_key = '_thumbnail_id' AND meta_value = %d", $post_id ));
3464
3465      $comment_ids = $wpdb->get_col( $wpdb->prepare( "SELECT comment_ID FROM $wpdb->comments WHERE comment_post_ID = %d", $post_id ));
3466      if ( ! empty( $comment_ids ) ) {
3467           do_action( 'delete_comment', $comment_ids );
3468           foreach ( $comment_ids as $comment_id )
3469                wp_delete_comment( $comment_id, true );
3470           do_action( 'deleted_comment', $comment_ids );
3471      }
3472
3473      $post_meta_ids = $wpdb->get_col( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE post_id = %d ", $post_id ));
3474      if ( !empty($post_meta_ids) ) {
3475           do_action( 'delete_postmeta', $post_meta_ids );
3476           $in_post_meta_ids = "'" . implode("', '", $post_meta_ids) . "'";