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 |
|---|---|
| 502 | } else { |
| 503 | if ( check_comment($author, $email, $url, $comment, $user_ip, $user_agent, $comment_type) ) |
| 504 | $approved = 1; |
| 505 | else |
| 506 | $approved = 0; |
| 507 | if ( wp_blacklist_check($author, $email, $url, $comment, $user_ip, $user_agent) ) |
| 508 | $approved = 'spam'; |
| 509 | } |
| 510 | |
| 511 | $approved = apply_filters('pre_comment_approved', $approved); |
| 512 | |
| 513 | $result = $wpdb->query("INSERT INTO $wpdb->comments |
| 514 | (comment_post_ID, comment_author, comment_author_email, comment_author_url, comment_author_IP, comment_date, comment_date_gmt, comment_content, comment_approved, comment_agent, comment_type, user_id) |
| 515 | VALUES |
| 516 | ('$comment_post_ID', '$author', '$email', '$url', '$user_ip', '$now', '$now_gmt', '$comment', '$approved', '$user_agent', '$comment_type', '$user_id') |
| 517 | "); |
| 518 | |
| 519 | $comment_id = $wpdb->insert_id; |
| 520 | do_action('comment_post', $comment_id, $approved); |