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.
Line | Code |
---|---|
22 | $status = $wpdb->get_row( $wpdb->prepare("SELECT post_status, comment_status FROM $wpdb->posts WHERE ID = %d", $comment_post_ID) ); |
23 |
|
24 | if ( empty($status->comment_status) ) { |
25 | do_action('comment_id_not_found', $comment_post_ID); |
26 | exit; |
27 | } elseif ( !comments_open($comment_post_ID) ) { |
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; |