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 |
|---|---|
| 7 | require( dirname(__FILE__) . '/wp-config.php' ); |
| 8 | |
| 9 | nocache_headers(); |
| 10 | |
| 11 | $comment_post_ID = (int) $_POST['comment_post_ID']; |
| 12 | |
| 13 | $status = $wpdb->get_row("SELECT post_status, comment_status FROM $wpdb->posts WHERE ID = '$comment_post_ID'"); |
| 14 | |
| 15 | if ( empty($status->comment_status) ) { |
| 16 | do_action('comment_id_not_found', $comment_post_ID); |
| 17 | exit; |
| 18 | } elseif ( 'closed' == $status->comment_status ) { |
| 19 | do_action('comment_closed', $comment_post_ID); |
| 20 | wp_die( __('Sorry, comments are closed for this item.') ); |
| 21 | } elseif ( 'draft' == $status->post_status ) { |
| 22 | do_action('comment_on_draft', $comment_post_ID); |
| 23 | exit; |
| 24 | } |
| 25 | |
| 26 | $comment_author = trim(strip_tags($_POST['author'])); |
| 27 | $comment_author_email = trim($_POST['email']); |
| 28 | $comment_author_url = trim($_POST['url']); |
| 29 | $comment_content = trim($_POST['comment']); |
| 30 | |
| 31 | // If the user is logged in |
| 32 | $user = wp_get_current_user(); |
| 33 | if ( $user->ID ) { |
| 34 | $comment_author = $wpdb->escape($user->display_name); |
| 35 | $comment_author_email = $wpdb->escape($user->user_email); |
| 36 | $comment_author_url = $wpdb->escape($user->user_url); |
| 37 | if ( current_user_can('unfiltered_html') ) { |