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 |
---|---|
254 | self::$last_comment_result = 'spam'; |
255 |
|
256 | $discard = ( isset( $commentdata['akismet_pro_tip'] ) && $commentdata['akismet_pro_tip'] === 'discard' && self::allow_discard() ); |
257 |
|
258 | do_action( 'akismet_spam_caught', $discard ); |
259 |
|
260 | if ( $discard ) { |
261 | // The spam is obvious, so we're bailing out early. |
262 | // akismet_result_spam() won't be called so bump the counter here |
263 | if ( $incr = apply_filters( 'akismet_spam_count_incr', 1 ) ) { |
264 | update_option( 'akismet_spam_count', get_option( 'akismet_spam_count' ) + $incr ); |
265 | } |
266 |
|
267 | if ( 'rest_api' === $context ) { |
268 | return new WP_Error( 'akismet_rest_comment_discarded', __( 'Comment discarded.', 'akismet' ) ); |
269 | } else if ( 'xml-rpc' === $context ) { |
270 | // If this is a pingback that we're pre-checking, the discard behavior is the same as the normal spam response behavior. |
271 | return $commentdata; |
272 | } else { |
Line | Code |
1147 | // If the last comment we checked has had its approval set to 'trash', |
1148 | // then it failed the comment blacklist check. Let that blacklist override |
1149 | // the spam check, since users have the (valid) expectation that when |
1150 | // they fill out their blacklists, comments that match it will always |
1151 | // end up in the trash. |
1152 | return $approved; |
1153 | } |
1154 |
|
1155 | // bump the counter here instead of when the filter is added to reduce the possibility of overcounting |
1156 | if ( $incr = apply_filters('akismet_spam_count_incr', 1) ) |
1157 | update_option( 'akismet_spam_count', get_option('akismet_spam_count') + $incr ); |
1158 |
|
1159 | return self::$last_comment_result; |
1160 | } |
1161 | |
1162 | /** |
1163 | * If Akismet is temporarily unreachable, we don't want to "spam" the blogger with |
1164 | * moderation emails for comments that will be automatically cleared or spammed on |
1165 | * the next retry. |