Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: wp_insert_comment

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

Line Code
1282      $data = compact('comment_post_ID', 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_author_IP', 'comment_date', 'comment_date_gmt', 'comment_content', 'comment_karma', 'comment_approved', 'comment_agent', 'comment_type', 'comment_parent', 'user_id');
1283      $wpdb->insert($wpdb->comments, $data);
1284
1285      $id = (int) $wpdb->insert_id;
1286
1287      if ( $comment_approved == 1 )
1288           wp_update_comment_count($comment_post_ID);
1289
1290      $comment = get_comment($id);
1291      do_action('wp_insert_comment', $id, $comment);
1292
1293      if ( function_exists( 'wp_cache_incr' ) ) {
1294           wp_cache_incr( 'last_changed', 1, 'comment' );
1295      } else {
1296           $last_changed = wp_cache_get( 'last_changed', 'comment' );
1297           wp_cache_set( 'last_changed', $last_changed + 1, 'comment' );
1298      }
1299
1300      return $id;