Anyone Can Type Here: The 3 Hooks That Decide What a WordPress Comment Becomes
The Problem A comment form is the one place on most WordPress sites where an anonymous visitor’s text ends up stored in the database and rendered back to…

Action Hook since 2.8.0
Fires right after a comment row is written to the database
wp_insert_comment is the lower-level sibling of comment_post — it fires for every comment insert, including ones triggered programmatically, not just front-end submissions.
Runs inside wp_insert_comment(), called by wp_new_comment() (front-end) as well as directly by REST API and import code.
do_action( 'wp_insert_comment', int $id, WP_Comment $comment );$id int — The new comment's ID.$comment WP_Comment — The full comment object.add_action( 'wp_insert_comment', function( $id, $comment ) {
error_log( 'New comment #' . $id . ' on post ' . $comment->comment_post_ID );
}, 10, 2 );Log every comment insert regardless of where it came from.

The Problem A comment form is the one place on most WordPress sites where an anonymous visitor’s text ends up stored in the database and rendered back to…
comment_post is specific to the standard front-end submission flow and gives you the approval status directly. wp_insert_comment fires for every insert path (including REST/import) and gives you the full WP_Comment object.
Source: wp-includes/comment.php
One session: this hook, then each related_hooks entry. Walk it and tell us what to change.
wp_insert_comment → comment_post
Practice the wp_insert_comment WordPress action hook in our interactive sandbox — a VS Code-style editor with a step-by-step wp_insert_comment tutorial, add_action exercises, and instant feedback. No local WordPress install required.