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 |
|---|---|
| 342 | // if the response is neither true nor false, hold the comment for moderation and schedule a recheck |
| 343 | if ( 'true' != $response[1] && 'false' != $response[1] ) { |
| 344 | if ( !current_user_can('moderate_comments') ) { |
| 345 | // Comment status should be moderated |
| 346 | self::$last_comment_result = '0'; |
| 347 | } |
| 348 | |
| 349 | if ( ! wp_next_scheduled( 'akismet_schedule_cron_recheck' ) ) { |
| 350 | wp_schedule_single_event( time() + 1200, 'akismet_schedule_cron_recheck' ); |
| 351 | do_action( 'akismet_scheduled_recheck', 'invalid-response-' . $response[1] ); |
| 352 | } |
| 353 | |
| 354 | self::$prevent_moderation_email_for_these_comments[] = $commentdata; |
| 355 | } |
| 356 | |
| 357 | // Delete old comments daily |
| 358 | if ( ! wp_next_scheduled( 'akismet_scheduled_delete' ) ) { |
| 359 | wp_schedule_event( time(), 'daily', 'akismet_scheduled_delete' ); |
| 360 | } |
| Line | Code |
| 945 | public static function cron_recheck() { |
| 946 | global $wpdb; |
| 947 | |
| 948 | $api_key = self::get_api_key(); |
| 949 | |
| 950 | $status = self::verify_key( $api_key ); |
| 951 | if ( get_option( 'akismet_alert_code' ) || $status == 'invalid' ) { |
| 952 | // since there is currently a problem with the key, reschedule a check for 6 hours hence |
| 953 | wp_schedule_single_event( time() + 21600, 'akismet_schedule_cron_recheck' ); |
| 954 | do_action( 'akismet_scheduled_recheck', 'key-problem-' . get_option( 'akismet_alert_code' ) . '-' . $status ); |
| 955 | return false; |
| 956 | } |
| 957 | |
| 958 | delete_option('akismet_available_servers'); |
| 959 | |
| 960 | $comment_errors = $wpdb->get_col( "SELECT comment_id FROM {$wpdb->commentmeta} WHERE meta_key = 'akismet_error' LIMIT 100" ); |
| 961 | |
| 962 | load_plugin_textdomain( 'akismet' ); |
| 963 | |
| Line | Code |
| 1012 | // If this comment has been pending moderation for longer than MAX_DELAY_BEFORE_MODERATION_EMAIL, |
| 1013 | // send a moderation email now. |
| 1014 | if ( ( intval( gmdate( 'U' ) ) - strtotime( $comment->comment_date_gmt ) ) < self::MAX_DELAY_BEFORE_MODERATION_EMAIL ) { |
| 1015 | delete_comment_meta( $comment_id, 'akismet_delayed_moderation_email' ); |
| 1016 | wp_notify_moderator( $comment_id ); |
| 1017 | } |
| 1018 | |
| 1019 | delete_comment_meta( $comment_id, 'akismet_rechecking' ); |
| 1020 | wp_schedule_single_event( time() + 1200, 'akismet_schedule_cron_recheck' ); |
| 1021 | do_action( 'akismet_scheduled_recheck', 'check-db-comment-' . $status ); |
| 1022 | return; |
| 1023 | } |
| 1024 | delete_comment_meta( $comment_id, 'akismet_rechecking' ); |
| 1025 | } |
| 1026 | |
| 1027 | $remaining = $wpdb->get_var( "SELECT COUNT(*) FROM {$wpdb->commentmeta} WHERE meta_key = 'akismet_error'" ); |
| 1028 | if ( $remaining && !wp_next_scheduled('akismet_schedule_cron_recheck') ) { |
| 1029 | wp_schedule_single_event( time() + 1200, 'akismet_schedule_cron_recheck' ); |
| 1030 | do_action( 'akismet_scheduled_recheck', 'remaining' ); |
| 1031 | } |
| 1032 | } |
| 1033 | |
| 1034 | public static function fix_scheduled_recheck() { |
| 1035 | $future_check = wp_next_scheduled( 'akismet_schedule_cron_recheck' ); |
| 1036 | if ( !$future_check ) { |
| 1037 | return; |
| 1038 | } |
| 1039 | |
| 1040 | if ( get_option( 'akismet_alert_code' ) > 0 ) { |
| 1041 | return; |
| 1042 | } |
| 1043 | |
| 1044 | $check_range = time() + 1200; |
| 1045 | if ( $future_check > $check_range ) { |
| 1046 | wp_clear_scheduled_hook( 'akismet_schedule_cron_recheck' ); |
| 1047 | wp_schedule_single_event( time() + 300, 'akismet_schedule_cron_recheck' ); |
| 1048 | do_action( 'akismet_scheduled_recheck', 'fix-scheduled-recheck' ); |
| 1049 | } |
| 1050 | } |
| 1051 | |
| 1052 | public static function add_comment_nonce( $post_id ) { |
| 1053 | /** |
| 1054 | * To disable the Akismet comment nonce, add a filter for the 'akismet_comment_nonce' tag |
| 1055 | * and return any string value that is not 'true' or '' (empty string). |
| 1056 | * |
| 1057 | * Don't return boolean false, because that implies that the 'akismet_comment_nonce' option |