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
730  * @uses do_action() Calls 'delete_comment' hook on comment ID
731  * @uses do_action() Calls 'wp_set_comment_status' hook on comment ID with 'delete' set for the second parameter
732  * @uses wp_transition_comment_status() Passes new and old comment status along with $comment object
733  *
734  * @param int $comment_id Comment ID
735  * @return bool False if delete comment query failure, true on success.
736  */
737 function wp_delete_comment($comment_id) {
738      global $wpdb;
739      do_action('delete_comment', $comment_id);
740
741      $comment = get_comment($comment_id);
742
743      if ( ! $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->comments WHERE comment_ID = %d LIMIT 1", $comment_id) ) )
744           return false;
745
746      // Move children up a level.
747      $children = $wpdb->get_col( $wpdb->prepare("SELECT comment_ID FROM $wpdb->comments WHERE comment_parent = %d", $comment_id) );
748      if ( !empty($children) ) {