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
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);
496
497      clean_comment_cache($comment_id);
498
499      do_action('wp_set_comment_status', $comment_id, 'delete');
500      return true;
501 }
502
503 /**
504  * wp_get_comment_status() - The status of a comment by ID
505  *
506  * @since 1.0.0
507  *
508  * @param int $comment_id Comment ID
 
Line Code
728           default:
729                return false;
730      }
731
732      if ( !$wpdb->query($query) )
733           return false;
734
735      clean_comment_cache($comment_id);
736
737      do_action('wp_set_comment_status', $comment_id, $comment_status);
738      $comment = get_comment($comment_id);
739      wp_update_comment_count($comment->comment_post_ID);
740
741      return true;
742 }
743
744 /**
745  * wp_update_comment() - Parses and updates an existing comment in the database
746  *