WP hooks navigation: Home/browse • Actions index • Filters index
To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).
The best way to understand what a hook does is to look at where it occurs in the source code.
do_action( "hook_name" )
apply_filters( "hook_name", "what_to_filter" )
.Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.
Line | Code |
---|---|
726 | * @uses do_action() Calls 'delete_comment' hook on comment ID |
727 | * @uses do_action() Calls 'wp_set_comment_status' hook on comment ID with 'delete' set for the second parameter |
728 | * @uses wp_transition_comment_status() Passes new and old comment status along with $comment object |
729 | * |
730 | * @param int $comment_id Comment ID |
731 | * @return bool False if delete comment query failure, true on success. |
732 | */ |
733 | function wp_delete_comment($comment_id) { |
734 | global $wpdb; |
735 | do_action('delete_comment', $comment_id); |
736 |
|
737 | $comment = get_comment($comment_id); |
738 |
|
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); |