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
264            )
265                return true;
266      }
267      return false;
268 }
269
270
271 function wp_delete_comment($comment_id) {
272      global $wpdb;
273      do_action('delete_comment', $comment_id);
274
275      $comment = get_comment($comment_id);
276
277      if ( ! $wpdb->query("DELETE FROM $wpdb->comments WHERE comment_ID='$comment_id' LIMIT 1") )
278           return false;
279
280      $post_id = $comment->comment_post_ID;
281      if ( $post_id && $comment->comment_approved == 1 )
282           wp_update_comment_count($post_id);