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.
This hook occurs 2 times in this file.
Line | Code |
---|---|
192 | $response = explode( "\r\n\r\n", $response, 2 ); |
193 | } |
194 | return $response; |
195 | } |
196 | } |
197 |
|
198 | // filter handler used to return a spam result to pre_comment_approved |
199 | function akismet_result_spam( $approved ) { |
200 | // bump the counter here instead of when the filter is added to reduce the possibility of overcounting |
201 | if ( $incr = apply_filters('akismet_spam_count_incr', 1) ) |
202 | update_option( 'akismet_spam_count', get_option('akismet_spam_count') + $incr ); |
203 | // this is a one-shot deal |
204 | remove_filter( 'pre_comment_approved', 'akismet_result_spam' ); |
205 | return 'spam'; |
206 | } |
207 |
|
208 | function akismet_result_hold( $approved ) { |
209 | // once only |
210 | remove_filter( 'pre_comment_approved', 'akismet_result_hold' ); |
Line | Code |
378 |
|
379 | do_action( 'akismet_spam_caught' ); |
380 |
|
381 | $last_updated = strtotime( $post->post_modified_gmt ); |
382 | $diff = time() - $last_updated; |
383 | $diff = $diff / 86400; |
384 | |
385 | if ( $post->post_type == 'post' && $diff > 30 && get_option( 'akismet_discard_month' ) == 'true' && empty($comment['user_ID']) ) { |
386 | // akismet_result_spam() won't be called so bump the counter here |
387 | if ( $incr = apply_filters('akismet_spam_count_incr', 1) ) |
388 | update_option( 'akismet_spam_count', get_option('akismet_spam_count') + $incr ); |
389 | wp_safe_redirect( $_SERVER['HTTP_REFERER'] ); |
390 | die(); |
391 | } |
392 | } |
393 | |
394 | // if the response is neither true nor false, hold the comment for moderation and schedule a recheck |
395 | if ( 'true' != $response[1] && 'false' != $response[1] ) { |
396 | if ( !current_user_can('moderate_comments') ) { |