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