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 5 times in this file.
Line | Code |
---|---|
289 | // if the response is neither true nor false, hold the comment for moderation and schedule a recheck |
290 | if ( 'true' != $response[1] && 'false' != $response[1] ) { |
291 | if ( !current_user_can('moderate_comments') ) { |
292 | // Comment status should be moderated |
293 | self::$last_comment_result = '0'; |
294 | } |
295 |
|
296 | if ( ! wp_next_scheduled( 'akismet_schedule_cron_recheck' ) ) { |
297 | wp_schedule_single_event( time() + 1200, 'akismet_schedule_cron_recheck' ); |
298 | do_action( 'akismet_scheduled_recheck', 'invalid-response-' . $response[1] ); |
299 | } |
300 |
|
301 | self::$prevent_moderation_email_for_these_comments[] = $commentdata; |
302 | } |
303 |
|
304 | // Delete old comments daily |
305 | if ( ! wp_next_scheduled( 'akismet_scheduled_delete' ) ) { |
306 | wp_schedule_event( time(), 'daily', 'akismet_scheduled_delete' ); |
307 | } |
Line | Code |
892 | public static function cron_recheck() { |
893 | global $wpdb; |
894 |
|
895 | $api_key = self::get_api_key(); |
896 |
|
897 | $status = self::verify_key( $api_key ); |
898 | if ( get_option( 'akismet_alert_code' ) || $status == 'invalid' ) { |
899 | // since there is currently a problem with the key, reschedule a check for 6 hours hence |
900 | wp_schedule_single_event( time() + 21600, 'akismet_schedule_cron_recheck' ); |
901 | do_action( 'akismet_scheduled_recheck', 'key-problem-' . get_option( 'akismet_alert_code' ) . '-' . $status ); |
902 | return false; |
903 | } |
904 |
|
905 | delete_option('akismet_available_servers'); |
906 |
|
907 | $comment_errors = $wpdb->get_col( "SELECT comment_id FROM {$wpdb->commentmeta} WHERE meta_key = 'akismet_error' LIMIT 100" ); |
908 | |
909 | load_plugin_textdomain( 'akismet' ); |
910 |
|
Line | Code |
959 | // If this comment has been pending moderation for longer than MAX_DELAY_BEFORE_MODERATION_EMAIL, |
960 | // send a moderation email now. |
961 | if ( ( intval( gmdate( 'U' ) ) - strtotime( $comment->comment_date_gmt ) ) < self::MAX_DELAY_BEFORE_MODERATION_EMAIL ) { |
962 | delete_comment_meta( $comment_id, 'akismet_delayed_moderation_email' ); |
963 | wp_notify_moderator( $comment_id ); |
964 | } |
965 |
|
966 | delete_comment_meta( $comment_id, 'akismet_rechecking' ); |
967 | wp_schedule_single_event( time() + 1200, 'akismet_schedule_cron_recheck' ); |
968 | do_action( 'akismet_scheduled_recheck', 'check-db-comment-' . $status ); |
969 | return; |
970 | } |
971 | delete_comment_meta( $comment_id, 'akismet_rechecking' ); |
972 | } |
973 |
|
974 | $remaining = $wpdb->get_var( "SELECT COUNT(*) FROM {$wpdb->commentmeta} WHERE meta_key = 'akismet_error'" ); |
975 | if ( $remaining && !wp_next_scheduled('akismet_schedule_cron_recheck') ) { |
976 | wp_schedule_single_event( time() + 1200, 'akismet_schedule_cron_recheck' ); |
977 | do_action( 'akismet_scheduled_recheck', 'remaining' ); |
978 | } |
979 | } |
980 |
|
981 | public static function fix_scheduled_recheck() { |
982 | $future_check = wp_next_scheduled( 'akismet_schedule_cron_recheck' ); |
983 | if ( !$future_check ) { |
984 | return; |
985 | } |
986 |
|
987 | if ( get_option( 'akismet_alert_code' ) > 0 ) { |
988 | return; |
989 | } |
990 |
|
991 | $check_range = time() + 1200; |
992 | if ( $future_check > $check_range ) { |
993 | wp_clear_scheduled_hook( 'akismet_schedule_cron_recheck' ); |
994 | wp_schedule_single_event( time() + 300, 'akismet_schedule_cron_recheck' ); |
995 | do_action( 'akismet_scheduled_recheck', 'fix-scheduled-recheck' ); |
996 | } |
997 | } |
998 |
|
999 | public static function add_comment_nonce( $post_id ) { |
1000 | /** |
1001 | * To disable the Akismet comment nonce, add a filter for the 'akismet_comment_nonce' tag |
1002 | * and return any string value that is not 'true' or '' (empty string). |
1003 | * |
1004 | * Don't return boolean false, because that implies that the 'akismet_comment_nonce' option |