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 |
---|---|
266 | // if the response is neither true nor false, hold the comment for moderation and schedule a recheck |
267 | if ( 'true' != $response[1] && 'false' != $response[1] ) { |
268 | if ( !current_user_can('moderate_comments') ) { |
269 | // Comment status should be moderated |
270 | self::$last_comment_result = '0'; |
271 | } |
272 |
|
273 | if ( ! wp_next_scheduled( 'akismet_schedule_cron_recheck' ) ) { |
274 | wp_schedule_single_event( time() + 1200, 'akismet_schedule_cron_recheck' ); |
275 | do_action( 'akismet_scheduled_recheck', 'invalid-response-' . $response[1] ); |
276 | } |
277 |
|
278 | self::$prevent_moderation_email_for_these_comments[] = $commentdata; |
279 | } |
280 |
|
281 | // Delete old comments daily |
282 | if ( ! wp_next_scheduled( 'akismet_scheduled_delete' ) ) { |
283 | wp_schedule_event( time(), 'daily', 'akismet_scheduled_delete' ); |
284 | } |
Line | Code |
833 | public static function cron_recheck() { |
834 | global $wpdb; |
835 |
|
836 | $api_key = self::get_api_key(); |
837 |
|
838 | $status = self::verify_key( $api_key ); |
839 | if ( get_option( 'akismet_alert_code' ) || $status == 'invalid' ) { |
840 | // since there is currently a problem with the key, reschedule a check for 6 hours hence |
841 | wp_schedule_single_event( time() + 21600, 'akismet_schedule_cron_recheck' ); |
842 | do_action( 'akismet_scheduled_recheck', 'key-problem-' . get_option( 'akismet_alert_code' ) . '-' . $status ); |
843 | return false; |
844 | } |
845 |
|
846 | delete_option('akismet_available_servers'); |
847 |
|
848 | $comment_errors = $wpdb->get_col( "SELECT comment_id FROM {$wpdb->commentmeta} WHERE meta_key = 'akismet_error' LIMIT 100" ); |
849 | |
850 | load_plugin_textdomain( 'akismet' ); |
851 |
|
Line | Code |
900 | // If this comment has been pending moderation for longer than MAX_DELAY_BEFORE_MODERATION_EMAIL, |
901 | // send a moderation email now. |
902 | if ( ( intval( gmdate( 'U' ) ) - strtotime( $comment->comment_date_gmt ) ) < self::MAX_DELAY_BEFORE_MODERATION_EMAIL ) { |
903 | delete_comment_meta( $comment_id, 'akismet_delayed_moderation_email' ); |
904 | wp_notify_moderator( $comment_id ); |
905 | } |
906 |
|
907 | delete_comment_meta( $comment_id, 'akismet_rechecking' ); |
908 | wp_schedule_single_event( time() + 1200, 'akismet_schedule_cron_recheck' ); |
909 | do_action( 'akismet_scheduled_recheck', 'check-db-comment-' . $status ); |
910 | return; |
911 | } |
912 | delete_comment_meta( $comment_id, 'akismet_rechecking' ); |
913 | } |
914 |
|
915 | $remaining = $wpdb->get_var( "SELECT COUNT(*) FROM {$wpdb->commentmeta} WHERE meta_key = 'akismet_error'" ); |
916 | if ( $remaining && !wp_next_scheduled('akismet_schedule_cron_recheck') ) { |
917 | wp_schedule_single_event( time() + 1200, 'akismet_schedule_cron_recheck' ); |
918 | do_action( 'akismet_scheduled_recheck', 'remaining' ); |
919 | } |
920 | } |
921 |
|
922 | public static function fix_scheduled_recheck() { |
923 | $future_check = wp_next_scheduled( 'akismet_schedule_cron_recheck' ); |
924 | if ( !$future_check ) { |
925 | return; |
926 | } |
927 |
|
928 | if ( get_option( 'akismet_alert_code' ) > 0 ) { |
929 | return; |
930 | } |
931 |
|
932 | $check_range = time() + 1200; |
933 | if ( $future_check > $check_range ) { |
934 | wp_clear_scheduled_hook( 'akismet_schedule_cron_recheck' ); |
935 | wp_schedule_single_event( time() + 300, 'akismet_schedule_cron_recheck' ); |
936 | do_action( 'akismet_scheduled_recheck', 'fix-scheduled-recheck' ); |
937 | } |
938 | } |
939 |
|
940 | public static function add_comment_nonce( $post_id ) { |
941 | /** |
942 | * To disable the Akismet comment nonce, add a filter for the 'akismet_comment_nonce' tag |
943 | * and return any string value that is not 'true' or '' (empty string). |
944 | * |
945 | * Don't return boolean false, because that implies that the 'akismet_comment_nonce' option |