Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: akismet_comment_nonce

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

This hook occurs 2 times in this file.

Line Code
293           $comment['blog_lang']    = get_locale();
294           $comment['blog_charset'] = get_option( 'blog_charset' );
295           $comment['permalink']    = get_permalink( $comment['comment_post_ID'] );
296
297           if ( ! empty( $comment['user_ID'] ) ) {
298                $comment['user_role'] = self::get_user_roles( $comment['user_ID'] );
299           }
300
301           /** See filter documentation in init_hooks(). */
302           $akismet_nonce_option             = apply_filters( 'akismet_comment_nonce', get_option( 'akismet_comment_nonce' ) );
303           $comment['akismet_comment_nonce'] = 'inactive';
304           if ( $akismet_nonce_option == 'true' || $akismet_nonce_option == '' ) {
305                $comment['akismet_comment_nonce'] = 'failed';
306                if ( isset( $_POST['akismet_comment_nonce'] ) && wp_verify_nonce( $_POST['akismet_comment_nonce'], 'akismet_comment_nonce_' . $comment['comment_post_ID'] ) ) {
307                     $comment['akismet_comment_nonce'] = 'passed';
308                }
309
310                // comment reply in wp-admin
311                if ( isset( $_POST['_ajax_nonce-replyto-comment'] ) && check_ajax_referer( 'replyto-comment', '_ajax_nonce-replyto-comment' ) ) {
 
Line Code
1212            * Don't return boolean false, because that implies that the 'akismet_comment_nonce' option
1213            * has not been set and that Akismet should just choose the default behavior for that
1214            * situation.
1215            */
1216
1217           if ( ! self::get_api_key() ) {
1218                return;
1219           }
1220
1221           $akismet_comment_nonce_option = apply_filters( 'akismet_comment_nonce', get_option( 'akismet_comment_nonce' ) );
1222
1223           if ( $akismet_comment_nonce_option == 'true' || $akismet_comment_nonce_option == '' ) {
1224                echo '<p style="display: none;">';
1225                wp_nonce_field( 'akismet_comment_nonce_' . $post_id, 'akismet_comment_nonce', false );
1226                echo '</p>';
1227           }
1228      }
1229
1230      public static function is_test_mode() {