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
76      }
77      if ('delete' == $_POST['action']) {
78           check_admin_referer( $akismet_nonce );
79           if ( function_exists('current_user_can') && !current_user_can('moderate_comments') )
80                die(__('You do not have sufficient permission to moderate comments.'));
81
82           $delete_time = $wpdb->escape( $_POST['display_time'] );
83           $comment_ids = $wpdb->get_col( "SELECT comment_id FROM $wpdb->comments WHERE comment_approved = 'spam' AND '$delete_time' > comment_date_gmt" );
84           if ( !empty( $comment_ids ) ) {
85                do_action( 'delete_comment', $comment_ids );
86                $wpdb->query( "DELETE FROM $wpdb->comments WHERE comment_id IN ( " . implode( ', ', $comment_ids ) . " )");
87                wp_cache_delete( 'akismet_spam_count', 'widget' );
88           }
89           $to = add_query_arg( 'deleted', 'all', $_SERVER['HTTP_REFERER'] );
90           wp_redirect( $to );
91           exit;
92      }
93
94 if ( isset( $_GET['recovered'] ) ) {