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 |
---|---|
204 | // if the response is neither true nor false, hold the comment for moderation and schedule a recheck |
205 | if ( 'true' != $response[1] && 'false' != $response[1] ) { |
206 | if ( !current_user_can('moderate_comments') ) { |
207 | // Comment status should be moderated |
208 | self::$last_comment_result = '0'; |
209 | } |
210 | if ( function_exists('wp_next_scheduled') && function_exists('wp_schedule_single_event') ) { |
211 | if ( !wp_next_scheduled( 'akismet_schedule_cron_recheck' ) ) { |
212 | wp_schedule_single_event( time() + 1200, 'akismet_schedule_cron_recheck' ); |
213 | do_action( 'akismet_scheduled_recheck', 'invalid-response-' . $response[1] ); |
214 | } |
215 | } |
216 |
|
217 | self::$prevent_moderation_email_for_these_comments[] = $commentdata; |
218 | } |
219 |
|
220 | if ( function_exists('wp_next_scheduled') && function_exists('wp_schedule_event') ) { |
221 | // WP 2.1+: delete old comments daily |
222 | if ( !wp_next_scheduled( 'akismet_scheduled_delete' ) ) |
Line | Code |
669 | public static function cron_recheck() { |
670 | global $wpdb; |
671 |
|
672 | $api_key = self::get_api_key(); |
673 |
|
674 | $status = self::verify_key( $api_key ); |
675 | if ( get_option( 'akismet_alert_code' ) || $status == 'invalid' ) { |
676 | // since there is currently a problem with the key, reschedule a check for 6 hours hence |
677 | wp_schedule_single_event( time() + 21600, 'akismet_schedule_cron_recheck' ); |
678 | do_action( 'akismet_scheduled_recheck', 'key-problem-' . get_option( 'akismet_alert_code' ) . '-' . $status ); |
679 | return false; |
680 | } |
681 |
|
682 | delete_option('akismet_available_servers'); |
683 |
|
684 | $comment_errors = $wpdb->get_col( "SELECT comment_id FROM {$wpdb->commentmeta} WHERE meta_key = 'akismet_error' LIMIT 100" ); |
685 | |
686 | load_plugin_textdomain( 'akismet' ); |
687 |
|
Line | Code |
731 | // If this comment has been pending moderation for longer than MAX_DELAY_BEFORE_MODERATION_EMAIL, |
732 | // send a moderation email now. |
733 | if ( ( intval( gmdate( 'U' ) ) - strtotime( $comment->comment_date_gmt ) ) < self::MAX_DELAY_BEFORE_MODERATION_EMAIL ) { |
734 | delete_comment_meta( $comment_id, 'akismet_delayed_moderation_email' ); |
735 | wp_notify_moderator( $comment_id ); |
736 | } |
737 |
|
738 | delete_comment_meta( $comment_id, 'akismet_rechecking' ); |
739 | wp_schedule_single_event( time() + 1200, 'akismet_schedule_cron_recheck' ); |
740 | do_action( 'akismet_scheduled_recheck', 'check-db-comment-' . $status ); |
741 | return; |
742 | } |
743 | delete_comment_meta( $comment_id, 'akismet_rechecking' ); |
744 | } |
745 |
|
746 | $remaining = $wpdb->get_var( "SELECT COUNT(*) FROM {$wpdb->commentmeta} WHERE meta_key = 'akismet_error'" ); |
747 | if ( $remaining && !wp_next_scheduled('akismet_schedule_cron_recheck') ) { |
748 | wp_schedule_single_event( time() + 1200, 'akismet_schedule_cron_recheck' ); |
749 | do_action( 'akismet_scheduled_recheck', 'remaining' ); |
750 | } |
751 | } |
752 |
|
753 | public static function fix_scheduled_recheck() { |
754 | $future_check = wp_next_scheduled( 'akismet_schedule_cron_recheck' ); |
755 | if ( !$future_check ) { |
756 | return; |
757 | } |
758 |
|
759 | if ( get_option( 'akismet_alert_code' ) > 0 ) { |
760 | return; |
761 | } |
762 |
|
763 | $check_range = time() + 1200; |
764 | if ( $future_check > $check_range ) { |
765 | wp_clear_scheduled_hook( 'akismet_schedule_cron_recheck' ); |
766 | wp_schedule_single_event( time() + 300, 'akismet_schedule_cron_recheck' ); |
767 | do_action( 'akismet_scheduled_recheck', 'fix-scheduled-recheck' ); |
768 | } |
769 | } |
770 |
|
771 | public static function add_comment_nonce( $post_id ) { |
772 | /** |
773 | * To disable the Akismet comment nonce, add a filter for the 'akismet_comment_nonce' tag |
774 | * and return any string value that is not 'true' or '' (empty string). |
775 | * |
776 | * Don't return boolean false, because that implies that the 'akismet_comment_nonce' option |