Filters a comment’s data before it is sanitized and inserted into the database.
Parameters
$commentdataarray- Comment data.
Source
$commentdata = apply_filters( 'preprocess_comment', $commentdata );
| CARVIEW |
Filters a comment’s data before it is sanitized and inserted into the database.
$commentdataarrayThe $commentdata array contains the following indices:
'comment_post_ID' - The post to which the comment will apply
'comment_author' - (may be empty)
'comment_author_email' - (may be empty)
'comment_author_url' - (may be empty)
'comment_content' - The text of the proposed comment
'comment_type' - 'pingback', 'trackback', or empty for regular comments
'user_ID' - (empty if not logged in)
$commentdata = apply_filters( 'preprocess_comment', $commentdata );
| Used by | Description |
|---|---|
wp_new_comment()wp-includes/comment.php | Adds a new comment to the database. |
You must log in before being able to contribute a note or feedback.
Example migrated from Codex:
The example below remove the URL from the comment author text (comment_author_url) and changes the first character of each word of the comment content to upper case if it’s in all upper case.