Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: wp_set_comment_status

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
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);
283
284      do_action('wp_set_comment_status', $comment_id, 'delete');
285      return true;
286 }
287
288
289 function wp_get_comment_status($comment_id) {
290      global $wpdb;
291
292      $result = $wpdb->get_var("SELECT comment_approved FROM $wpdb->comments WHERE comment_ID='$comment_id' LIMIT 1");
293
 
Line Code
428                return wp_delete_comment($comment_id);
429                break;
430           default:
431                return false;
432      }
433
434      if ( !$wpdb->query($query) )
435           return false;
436
437      do_action('wp_set_comment_status', $comment_id, $comment_status);
438      $comment = get_comment($comment_id);
439      wp_update_comment_count($comment->comment_post_ID);
440      return true;
441 }
442
443
444 function wp_update_comment($commentarr) {
445      global $wpdb;
446