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
739      if ( ! $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->comments WHERE comment_ID = %d LIMIT 1", $comment_id) ) )
740           return false;
741
742      $post_id = $comment->comment_post_ID;
743      if ( $post_id && $comment->comment_approved == 1 )
744           wp_update_comment_count($post_id);
745
746      clean_comment_cache($comment_id);
747
748      do_action('wp_set_comment_status', $comment_id, 'delete');
749      wp_transition_comment_status('delete', $comment->comment_approved, $comment);
750      return true;
751 }
752
753 /**
754  * The status of a comment by ID.
755  *
756  * @since 1.0.0
757  *
 
Line Code
1036      }
1037
1038      if ( !$wpdb->query($query) )
1039           return false;
1040
1041      clean_comment_cache($comment_id);
1042
1043      $comment = get_comment($comment_id);
1044
1045      do_action('wp_set_comment_status', $comment_id, $comment_status);
1046      wp_transition_comment_status($comment_status, $comment->comment_approved, $comment);
1047
1048      wp_update_comment_count($comment->comment_post_ID);
1049
1050      return true;
1051 }
1052
1053 /**
1054  * Updates an existing comment in the database.