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 |
---|---|
185 | // akismet_spam_count will be incremented later by comment_is_spam() |
186 | self::$last_comment_result = 'spam'; |
187 |
|
188 | $discard = ( isset( $commentdata['akismet_pro_tip'] ) && $commentdata['akismet_pro_tip'] === 'discard' && self::allow_discard() ); |
189 |
|
190 | do_action( 'akismet_spam_caught', $discard ); |
191 |
|
192 | if ( $discard ) { |
193 | // akismet_result_spam() won't be called so bump the counter here |
194 | if ( $incr = apply_filters('akismet_spam_count_incr', 1) ) |
195 | update_option( 'akismet_spam_count', get_option('akismet_spam_count') + $incr ); |
196 | // The spam is obvious, so we're bailing out early. Redirect back to the previous page, |
197 | // or failing that, the post permalink, or failing that, the homepage of the blog. |
198 | $redirect_to = isset( $_SERVER['HTTP_REFERER'] ) ? $_SERVER['HTTP_REFERER'] : ( $post ? get_permalink( $post ) : home_url() ); |
199 | wp_safe_redirect( esc_url_raw( $redirect_to ) ); |
200 | die(); |
201 | } |
202 | } |
203 | |
Line | Code |
909 | } |
910 |
|
911 | // Only do this if it's the correct comment |
912 | if ( ! self::matches_last_comment( $comment ) ) { |
913 | self::log( "comment_is_spam mismatched comment, returning unaltered $approved" ); |
914 | return $approved; |
915 | } |
916 |
|
917 | // bump the counter here instead of when the filter is added to reduce the possibility of overcounting |
918 | if ( $incr = apply_filters('akismet_spam_count_incr', 1) ) |
919 | update_option( 'akismet_spam_count', get_option('akismet_spam_count') + $incr ); |
920 |
|
921 | return self::$last_comment_result; |
922 | } |
923 | |
924 | /** |
925 | * If Akismet is temporarily unreachable, we don't want to "spam" the blogger with |
926 | * moderation emails for comments that will be automatically cleared or spammed on |
927 | * the next retry. |