Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: pre_comment_on_post

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
28      do_action('comment_closed', $comment_post_ID);
29      wp_die( __('Sorry, comments are closed for this item.') );
30 } elseif ( in_array($status->post_status, array('draft', 'pending') ) ) {
31      do_action('comment_on_draft', $comment_post_ID);
32      exit;
33 } elseif ( 'trash' == $status->post_status ) {
34      do_action('comment_on_trash', $comment_post_ID);
35      exit;
36 } else {
37      do_action('pre_comment_on_post', $comment_post_ID);
38 }
39
40 $comment_author       = ( isset($_POST['author']) )  ? trim(strip_tags($_POST['author'])) : null;
41 $comment_author_email = ( isset($_POST['email']) )   ? trim($_POST['email']) : null;
42 $comment_author_url   = ( isset($_POST['url']) )     ? trim($_POST['url']) : null;
43 $comment_content      = ( isset($_POST['comment']) ) ? trim($_POST['comment']) : null;
44
45 // If the user is logged in
46 $user = wp_get_current_user();