Filters a comment’s approval status before it is set.
$commentdata array contains the same indices as the array returned by WP_Comment_Query::get_comments(), including:
'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_author_IP' - IP address
'comment_agent' - e.g., "Mozilla/5.0..."
'comment_content' - The text of the proposed comment
'comment_type' - 'pingback', 'trackback', or empty for regular comments
'user_ID' - (empty if not logged in)
0 (int) comment is marked for moderation as "Pending"
1 (int) comment is marked for immediate publication as "Approved"
'spam' (string) comment is marked as "Spam"
'trash' (string) comment is to be put in the Trash
return apply_filters( 'pre_comment_approved', $approved, $comment_data );
© 2003–2024 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/hooks/pre_comment_approved