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

Line Code
522  * @uses $wpdb
523  * @uses do_action() Calls 'delete_comment' hook on comment ID
524  * @uses do_action() Calls 'wp_set_comment_status' hook on comment ID with 'delete' set for the second parameter
525  *
526  * @param int $comment_id Comment ID
527  * @return bool False if delete comment query failure, true on success
528  */
529 function wp_delete_comment($comment_id) {
530      global $wpdb;
531      do_action('delete_comment', $comment_id);
532
533      $comment = get_comment($comment_id);
534
535      if ( ! $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->comments WHERE comment_ID = %d LIMIT 1", $comment_id) ) )
536           return false;
537
538      $post_id = $comment->comment_post_ID;
539      if ( $post_id && $comment->comment_approved == 1 )
540           wp_update_comment_count($post_id);