preprocess_comment
Filters a comment's data before it is sanitized and inserted into the database.
Usage
add_filter( 'preprocess_comment', 'wp_kama_preprocess_comment_filter' ); /** * Function for `preprocess_comment` filter-hook. * * @param array $commentdata Comment data. * * @return array */ function wp_kama_preprocess_comment_filter( $commentdata ){ // filter... return $commentdata; }
- $commentdata(array)
- Comment data.
Changelog
Since 1.5.0 | Introduced. |
Since 5.6.0 | Comment data includes the comment_agent and comment_author_IP values. |
Where the hook is called
preprocess_comment
wp-includes/comment.php 2244
$commentdata = apply_filters( 'preprocess_comment', $commentdata );