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 |
|---|---|
| 225 | // if the response is neither true nor false, hold the comment for moderation and schedule a recheck |
| 226 | if ( 'true' != $response[1] && 'false' != $response[1] ) { |
| 227 | if ( !current_user_can('moderate_comments') ) { |
| 228 | // Comment status should be moderated |
| 229 | self::$last_comment_result = '0'; |
| 230 | } |
| 231 | |
| 232 | if ( ! wp_next_scheduled( 'akismet_schedule_cron_recheck' ) ) { |
| 233 | wp_schedule_single_event( time() + 1200, 'akismet_schedule_cron_recheck' ); |
| 234 | do_action( 'akismet_scheduled_recheck', 'invalid-response-' . $response[1] ); |
| 235 | } |
| 236 | |
| 237 | self::$prevent_moderation_email_for_these_comments[] = $commentdata; |
| 238 | } |
| 239 | |
| 240 | // Delete old comments daily |
| 241 | if ( ! wp_next_scheduled( 'akismet_scheduled_delete' ) ) { |
| 242 | wp_schedule_event( time(), 'daily', 'akismet_scheduled_delete' ); |
| 243 | } |
| Line | Code |
| 682 | public static function cron_recheck() { |
| 683 | global $wpdb; |
| 684 | |
| 685 | $api_key = self::get_api_key(); |
| 686 | |
| 687 | $status = self::verify_key( $api_key ); |
| 688 | if ( get_option( 'akismet_alert_code' ) || $status == 'invalid' ) { |
| 689 | // since there is currently a problem with the key, reschedule a check for 6 hours hence |
| 690 | wp_schedule_single_event( time() + 21600, 'akismet_schedule_cron_recheck' ); |
| 691 | do_action( 'akismet_scheduled_recheck', 'key-problem-' . get_option( 'akismet_alert_code' ) . '-' . $status ); |
| 692 | return false; |
| 693 | } |
| 694 | |
| 695 | delete_option('akismet_available_servers'); |
| 696 | |
| 697 | $comment_errors = $wpdb->get_col( "SELECT comment_id FROM {$wpdb->commentmeta} WHERE meta_key = 'akismet_error' LIMIT 100" ); |
| 698 | |
| 699 | load_plugin_textdomain( 'akismet' ); |
| 700 | |
| Line | Code |
| 744 | // If this comment has been pending moderation for longer than MAX_DELAY_BEFORE_MODERATION_EMAIL, |
| 745 | // send a moderation email now. |
| 746 | if ( ( intval( gmdate( 'U' ) ) - strtotime( $comment->comment_date_gmt ) ) < self::MAX_DELAY_BEFORE_MODERATION_EMAIL ) { |
| 747 | delete_comment_meta( $comment_id, 'akismet_delayed_moderation_email' ); |
| 748 | wp_notify_moderator( $comment_id ); |
| 749 | } |
| 750 | |
| 751 | delete_comment_meta( $comment_id, 'akismet_rechecking' ); |
| 752 | wp_schedule_single_event( time() + 1200, 'akismet_schedule_cron_recheck' ); |
| 753 | do_action( 'akismet_scheduled_recheck', 'check-db-comment-' . $status ); |
| 754 | return; |
| 755 | } |
| 756 | delete_comment_meta( $comment_id, 'akismet_rechecking' ); |
| 757 | } |
| 758 | |
| 759 | $remaining = $wpdb->get_var( "SELECT COUNT(*) FROM {$wpdb->commentmeta} WHERE meta_key = 'akismet_error'" ); |
| 760 | if ( $remaining && !wp_next_scheduled('akismet_schedule_cron_recheck') ) { |
| 761 | wp_schedule_single_event( time() + 1200, 'akismet_schedule_cron_recheck' ); |
| 762 | do_action( 'akismet_scheduled_recheck', 'remaining' ); |
| 763 | } |
| 764 | } |
| 765 | |
| 766 | public static function fix_scheduled_recheck() { |
| 767 | $future_check = wp_next_scheduled( 'akismet_schedule_cron_recheck' ); |
| 768 | if ( !$future_check ) { |
| 769 | return; |
| 770 | } |
| 771 | |
| 772 | if ( get_option( 'akismet_alert_code' ) > 0 ) { |
| 773 | return; |
| 774 | } |
| 775 | |
| 776 | $check_range = time() + 1200; |
| 777 | if ( $future_check > $check_range ) { |
| 778 | wp_clear_scheduled_hook( 'akismet_schedule_cron_recheck' ); |
| 779 | wp_schedule_single_event( time() + 300, 'akismet_schedule_cron_recheck' ); |
| 780 | do_action( 'akismet_scheduled_recheck', 'fix-scheduled-recheck' ); |
| 781 | } |
| 782 | } |
| 783 | |
| 784 | public static function add_comment_nonce( $post_id ) { |
| 785 | /** |
| 786 | * To disable the Akismet comment nonce, add a filter for the 'akismet_comment_nonce' tag |
| 787 | * and return any string value that is not 'true' or '' (empty string). |
| 788 | * |
| 789 | * Don't return boolean false, because that implies that the 'akismet_comment_nonce' option |