Title: wp-includes/comment.php | Page 2 of 5 | Developer.WordPress.org

---

# File: wp-includes/comment.php

 * hook[pre_wp_update_comment_count_now](https://developer.wordpress.org/reference/hooks/pre_wp_update_comment_count_now/)
 * Filters a post’s comment count before it is updated in the database.
 * Used by [1 function](https://developer.wordpress.org/reference/hooks/pre_wp_update_comment_count_now/#used-by)
   | Uses [0 functions](https://developer.wordpress.org/reference/hooks/pre_wp_update_comment_count_now/#uses)
   | Source: [wp-includes/comment.php:2872](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/comment.php#L2872-L2872)
 * function[wp_get_comment_fields_max_lengths()](https://developer.wordpress.org/reference/functions/wp_get_comment_fields_max_lengths/)
 * Retrieves the maximum character lengths for the comment form fields.
 * Used by [1 function](https://developer.wordpress.org/reference/functions/wp_get_comment_fields_max_lengths/#used-by)
   | Uses [3 functions](https://developer.wordpress.org/reference/functions/wp_get_comment_fields_max_lengths/#uses)
   | Source: [wp-includes/comment.php:1203](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/comment.php#L1203-L1247)
 * hook[wp_get_comment_fields_max_lengths](https://developer.wordpress.org/reference/hooks/wp_get_comment_fields_max_lengths/)
 * Filters the lengths for the comment form fields.
 * Used by [1 function](https://developer.wordpress.org/reference/hooks/wp_get_comment_fields_max_lengths/#used-by)
   | Uses [0 functions](https://developer.wordpress.org/reference/hooks/wp_get_comment_fields_max_lengths/#uses)
   | Source: [wp-includes/comment.php:1246](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/comment.php#L1246-L1246)
 * function[_prime_comment_caches()](https://developer.wordpress.org/reference/functions/_prime_comment_caches/)
 * Adds any comments from the given IDs to the cache that do not already exist in
   cache.
 * Used by [3 functions](https://developer.wordpress.org/reference/functions/_prime_comment_caches/#used-by)
   | Uses [4 functions](https://developer.wordpress.org/reference/functions/_prime_comment_caches/#uses)
   | Source: [wp-includes/comment.php:3471](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/comment.php#L3471-L3484)
 * function[wp_handle_comment_submission()](https://developer.wordpress.org/reference/functions/wp_handle_comment_submission/)
 * Handles the submission of a comment, usually posted to wp-comments-post.php via
   a comment form.
 * Used by [0 functions](https://developer.wordpress.org/reference/functions/wp_handle_comment_submission/#used-by)
   | Uses [24 functions](https://developer.wordpress.org/reference/functions/wp_handle_comment_submission/#uses)
   | Source: [wp-includes/comment.php:3595](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/comment.php#L3595-L3816)
 * function[wp_new_comment_notify_moderator()](https://developer.wordpress.org/reference/functions/wp_new_comment_notify_moderator/)
 * Sends a comment moderation notification to the comment moderator.
 * Used by [0 functions](https://developer.wordpress.org/reference/functions/wp_new_comment_notify_moderator/#used-by)
   | Uses [3 functions](https://developer.wordpress.org/reference/functions/wp_new_comment_notify_moderator/#uses)
   | Source: [wp-includes/comment.php:2443](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/comment.php#L2443-L2457)
 * function[wp_new_comment_notify_postauthor()](https://developer.wordpress.org/reference/functions/wp_new_comment_notify_postauthor/)
 * Sends a notification of a new comment to the post author.
 * Used by [1 function](https://developer.wordpress.org/reference/functions/wp_new_comment_notify_postauthor/#used-by)
   | Uses [4 functions](https://developer.wordpress.org/reference/functions/wp_new_comment_notify_postauthor/#uses)
   | Source: [wp-includes/comment.php:2470](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/comment.php#L2470-L2503)
 * hook[notify_post_author](https://developer.wordpress.org/reference/hooks/notify_post_author/)
 * Filters whether to send the post author new comment notification emails, overriding
   the site setting.
 * Used by [1 function](https://developer.wordpress.org/reference/hooks/notify_post_author/#used-by)
   | Uses [0 functions](https://developer.wordpress.org/reference/hooks/notify_post_author/#uses)
   | Source: [wp-includes/comment.php:2485](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/comment.php#L2485-L2485)
 * hook[get_page_of_comment](https://developer.wordpress.org/reference/hooks/get_page_of_comment/)
 * Filters the calculated page on which a comment appears.
 * Used by [1 function](https://developer.wordpress.org/reference/hooks/get_page_of_comment/#used-by)
   | Uses [0 functions](https://developer.wordpress.org/reference/hooks/get_page_of_comment/#uses)
   | Source: [wp-includes/comment.php:1191](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/comment.php#L1191-L1191)
 * hook[duplicate_comment_id](https://developer.wordpress.org/reference/hooks/duplicate_comment_id/)
 * Filters the ID, if any, of the duplicate comment found when creating a new comment.
 * Used by [1 function](https://developer.wordpress.org/reference/hooks/duplicate_comment_id/#used-by)
   | Uses [0 functions](https://developer.wordpress.org/reference/hooks/duplicate_comment_id/#uses)
   | Source: [wp-includes/comment.php:727](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/comment.php#L727-L727)
 * function[get_default_comment_status()](https://developer.wordpress.org/reference/functions/get_default_comment_status/)
 * Gets the default comment status for a post type.
 * Used by [4 functions](https://developer.wordpress.org/reference/functions/get_default_comment_status/#used-by)
   | Uses [3 functions](https://developer.wordpress.org/reference/functions/get_default_comment_status/#uses)
   | Source: [wp-includes/comment.php:303](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/comment.php#L303-L336)
 * hook[get_default_comment_status](https://developer.wordpress.org/reference/hooks/get_default_comment_status/)
 * Filters the default comment status for the given post type.
 * Used by [1 function](https://developer.wordpress.org/reference/hooks/get_default_comment_status/#used-by)
   | Uses [0 functions](https://developer.wordpress.org/reference/hooks/get_default_comment_status/#uses)
   | Source: [wp-includes/comment.php:335](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/comment.php#L335-L335)
 * hook[wp_set_comment_status](https://developer.wordpress.org/reference/hooks/wp_set_comment_status/)
 * Fires immediately after transitioning a comment’s status from one to another 
   in the database and removing the comment from the object cache, but prior to 
   all status transition hooks.
 * Used by [2 functions](https://developer.wordpress.org/reference/hooks/wp_set_comment_status/#used-by)
   | Uses [0 functions](https://developer.wordpress.org/reference/hooks/wp_set_comment_status/#uses)
   | Source: [wp-includes/comment.php:2580](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/comment.php#L2580-L2580)
 * hook[comment_on_draft](https://developer.wordpress.org/reference/hooks/comment_on_draft/)
 * Fires when a comment is attempted on a post in draft mode.
 * Used by [1 function](https://developer.wordpress.org/reference/hooks/comment_on_draft/#used-by)
   | Uses [0 functions](https://developer.wordpress.org/reference/hooks/comment_on_draft/#uses)
   | Source: [wp-includes/comment.php:3705](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/comment.php#L3705-L3705)
 * hook[comment_on_password_protected](https://developer.wordpress.org/reference/hooks/comment_on_password_protected/)
 * Fires when a comment is attempted on a password-protected post.
 * Used by [1 function](https://developer.wordpress.org/reference/hooks/comment_on_password_protected/#used-by)
   | Uses [0 functions](https://developer.wordpress.org/reference/hooks/comment_on_password_protected/#uses)
   | Source: [wp-includes/comment.php:3721](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/comment.php#L3721-L3721)
 * hook[pre_comment_on_post](https://developer.wordpress.org/reference/hooks/pre_comment_on_post/)
 * Fires before a comment is posted.
 * Used by [1 function](https://developer.wordpress.org/reference/hooks/pre_comment_on_post/#used-by)
   | Uses [0 functions](https://developer.wordpress.org/reference/hooks/pre_comment_on_post/#uses)
   | Source: [wp-includes/comment.php:3733](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/comment.php#L3733-L3733)
 * hook[comment_id_not_found](https://developer.wordpress.org/reference/hooks/comment_id_not_found/)
 * Fires when a comment is attempted on a post that does not exist.
 * Used by [1 function](https://developer.wordpress.org/reference/hooks/comment_id_not_found/#used-by)
   | Uses [0 functions](https://developer.wordpress.org/reference/hooks/comment_id_not_found/#uses)
   | Source: [wp-includes/comment.php:3655](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/comment.php#L3655-L3655)
 * hook[comment_closed](https://developer.wordpress.org/reference/hooks/comment_closed/)
 * Fires when a comment is attempted on a post that has comments closed.
 * Used by [1 function](https://developer.wordpress.org/reference/hooks/comment_closed/#used-by)
   | Uses [0 functions](https://developer.wordpress.org/reference/hooks/comment_closed/#uses)
   | Source: [wp-includes/comment.php:3679](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/comment.php#L3679-L3679)
 * hook[comment_on_trash](https://developer.wordpress.org/reference/hooks/comment_on_trash/)
 * Fires when a comment is attempted on a trashed post.
 * Used by [1 function](https://developer.wordpress.org/reference/hooks/comment_on_trash/#used-by)
   | Uses [0 functions](https://developer.wordpress.org/reference/hooks/comment_on_trash/#uses)
   | Source: [wp-includes/comment.php:3692](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/comment.php#L3692-L3692)
 * function[pingback_ping_source_uri()](https://developer.wordpress.org/reference/functions/pingback_ping_source_uri/)
 * Default filter attached to pingback_ping_source_uri to validate the pingback’s
   Source URI.
 * Used by [0 functions](https://developer.wordpress.org/reference/functions/pingback_ping_source_uri/#used-by)
   | Uses [1 function](https://developer.wordpress.org/reference/functions/pingback_ping_source_uri/#uses)
   | Source: [wp-includes/comment.php:3376](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/comment.php#L3376-L3378)
 * function[xmlrpc_pingback_error()](https://developer.wordpress.org/reference/functions/xmlrpc_pingback_error/)
 * Default filter attached to xmlrpc_pingback_error.
 * Used by [0 functions](https://developer.wordpress.org/reference/functions/xmlrpc_pingback_error/#used-by)
   | Uses [1 function](https://developer.wordpress.org/reference/functions/xmlrpc_pingback_error/#uses)
   | Source: [wp-includes/comment.php:3393](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/comment.php#L3393-L3398)
 * function[clean_comment_cache()](https://developer.wordpress.org/reference/functions/clean_comment_cache/)
 * Removes a comment from the object cache.
 * Used by [8 functions](https://developer.wordpress.org/reference/functions/clean_comment_cache/#used-by)
   | Uses [3 functions](https://developer.wordpress.org/reference/functions/clean_comment_cache/#uses)
   | Source: [wp-includes/comment.php:3411](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/comment.php#L3411-L3426)
 * function[update_comment_cache()](https://developer.wordpress.org/reference/functions/update_comment_cache/)
 * Updates the comment cache of given comments.
 * Used by [1 function](https://developer.wordpress.org/reference/functions/update_comment_cache/#used-by)
   | Uses [2 functions](https://developer.wordpress.org/reference/functions/update_comment_cache/#uses)
   | Source: [wp-includes/comment.php:3441](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/comment.php#L3441-L3456)
 * function[_close_comments_for_old_posts()](https://developer.wordpress.org/reference/functions/_close_comments_for_old_posts/)
 * Closes comments on old posts on the fly, without any extra DB queries. Hooked
   to the_posts.
 * Used by [0 functions](https://developer.wordpress.org/reference/functions/_close_comments_for_old_posts/#used-by)
   | Uses [2 functions](https://developer.wordpress.org/reference/functions/_close_comments_for_old_posts/#uses)
   | Source: [wp-includes/comment.php:3500](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/comment.php#L3500-L3528)
 * hook[close_comments_for_post_types](https://developer.wordpress.org/reference/hooks/close_comments_for_post_types/)
 * Filters the list of post types to automatically close comments for.
 * Used by [2 functions](https://developer.wordpress.org/reference/hooks/close_comments_for_post_types/#used-by)
   | Uses [0 functions](https://developer.wordpress.org/reference/hooks/close_comments_for_post_types/#uses)
   | Source: [wp-includes/comment.php:3512](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/comment.php#L3512-L3512)
 * function[_close_comments_for_old_post()](https://developer.wordpress.org/reference/functions/_close_comments_for_old_post/)
 * Closes comments on an old post. Hooked to comments_open and pings_open.
 * Used by [0 functions](https://developer.wordpress.org/reference/functions/_close_comments_for_old_post/#used-by)
   | Uses [3 functions](https://developer.wordpress.org/reference/functions/_close_comments_for_old_post/#uses)
   | Source: [wp-includes/comment.php:3540](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/comment.php#L3540-L3572)
 * hook[pingback_useragent](https://developer.wordpress.org/reference/hooks/pingback_useragent/)
 * Filters the user agent sent when pinging-back a URL.
 * Used by [1 function](https://developer.wordpress.org/reference/hooks/pingback_useragent/#used-by)
   | Uses [0 functions](https://developer.wordpress.org/reference/hooks/pingback_useragent/#uses)
   | Source: [wp-includes/comment.php:3266](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/comment.php#L3266-L3266)
 * function[privacy_ping_filter()](https://developer.wordpress.org/reference/functions/privacy_ping_filter/)
 * Checks whether blog is public before returning sites.
 * Used by [0 functions](https://developer.wordpress.org/reference/functions/privacy_ping_filter/#used-by)
   | Uses [1 function](https://developer.wordpress.org/reference/functions/privacy_ping_filter/#uses)
   | Source: [wp-includes/comment.php:3292](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/comment.php#L3292-L3298)
 * function[trackback()](https://developer.wordpress.org/reference/functions/trackback/)
 * Sends a Trackback.
 * Used by [2 functions](https://developer.wordpress.org/reference/functions/trackback/#used-by)
   | Uses [6 functions](https://developer.wordpress.org/reference/functions/trackback/#uses)
   | Source: [wp-includes/comment.php:3315](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/comment.php#L3315-L3339)
 * function[weblog_ping()](https://developer.wordpress.org/reference/functions/weblog_ping/)
 * Sends a pingback.
 * Used by [1 function](https://developer.wordpress.org/reference/functions/weblog_ping/#used-by)
   | Uses [5 functions](https://developer.wordpress.org/reference/functions/weblog_ping/#uses)
   | Source: [wp-includes/comment.php:3349](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/comment.php#L3349-L3364)

 [Previous Page](https://developer.wordpress.org/reference/files/wp-includes/comment.php/?output_format=md)

[1](https://developer.wordpress.org/reference/files/wp-includes/comment.php/?output_format=md)
2 [3](https://developer.wordpress.org/reference/files/wp-includes/comment.php/page/3/?output_format=md)
[4](https://developer.wordpress.org/reference/files/wp-includes/comment.php/page/4/?output_format=md)
[5](https://developer.wordpress.org/reference/files/wp-includes/comment.php/page/5/?output_format=md)

 [Next Page](https://developer.wordpress.org/reference/files/wp-includes/comment.php/page/3/?output_format=md)