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 |
|---|---|
| 19 | |
| 20 | $comment_post_ID = (int) $_POST['comment_post_ID']; |
| 21 | |
| 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 | } else { |
| 34 | do_action('pre_comment_on_post', $comment_post_ID); |
| 35 | } |
| 36 | |
| 37 | $comment_author = ( isset($_POST['author']) ) ? trim(strip_tags($_POST['author'])) : null; |