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
477  * @uses $wpdb
478  * @uses do_action() Calls 'delete_comment' hook on comment ID
479  * @uses do_action() Calls 'wp_set_comment_status' hook on comment ID with 'delete' set for the second parameter
480  *
481  * @param int $comment_id Comment ID
482  * @return bool False if delete comment query failure, true on success
483  */
484 function wp_delete_comment($comment_id) {
485      global $wpdb;
486      do_action('delete_comment', $comment_id);
487
488      $comment = get_comment($comment_id);
489
490      if ( ! $wpdb->query("DELETE FROM $wpdb->comments WHERE comment_ID='$comment_id' LIMIT 1") )
491           return false;
492
493      $post_id = $comment->comment_post_ID;
494      if ( $post_id && $comment->comment_approved == 1 )
495           wp_update_comment_count($post_id);