{"id":5803,"date":"2026-02-12T20:45:27","date_gmt":"2026-02-13T01:45:27","guid":{"rendered":"https:\/\/chubes.net\/?documentation=wp-comments-post-php"},"modified":"2026-03-13T03:29:20","modified_gmt":"2026-03-13T07:29:20","slug":"wp-comments-post-php","status":"publish","type":"documentation","link":"https:\/\/chubes.net\/docs\/wordpress-core\/root-files\/wp-comments-post-php\/","title":{"rendered":"wp-comments-post.php"},"content":{"rendered":"<h2 class=\"wp-block-heading\">Purpose<\/h2><p>Processes comment submissions and prevents duplicate\/invalid posts.<\/p><h2 class=\"wp-block-heading\">Flow<\/h2><ul class=\"wp-block-list\"><li>Requires a POST request; otherwise returns 405.<\/li><li>Loads WordPress and disables cache headers.<\/li><li>Calls <code>wp_handle_comment_submission()<\/code> to validate and insert.<\/li><li>Fires cookie-setting hook and redirects to the comment location.<\/li><\/ul><h2 class=\"wp-block-heading\">Key functions called<\/h2><ul class=\"wp-block-list\"><li><code>wp_handle_comment_submission()<\/code><\/li><li><code>wp_get_current_user()<\/code><\/li><li><code>wp_safe_redirect()<\/code><\/li><\/ul><h2 class=\"wp-block-heading\">Hooks fired<\/h2><ul class=\"wp-block-list\"><li>Actions:<ul class=\"wp-block-list\"><li><code>set_comment_cookies<\/code><\/li><\/ul><\/li><li>Filters:<ul class=\"wp-block-list\"><li><code>comment_post_redirect<\/code><\/li><\/ul><\/li><\/ul>","protected":false},"excerpt":{"rendered":"<p>Purpose Processes comment submissions and prevents duplicate\/invalid posts. Flow Requires a POST request; otherwise returns 405. Loads WordPress and disables cache headers. Calls wp_handle_comment_submission() to validate and insert. Fires cookie-setting&#8230;<\/p>\n","protected":false},"featured_media":0,"template":"","meta":{"footnotes":""},"tags":[],"project":[657],"project_type":[749],"class_list":["post-5803","documentation","type-documentation","status-publish","hentry","project-root-files","project_type-wordpress-reference"],"project_info":{"id":589,"name":"WordPress Core","slug":"wordpress-core"},"project_type_info":{"id":749,"name":"WordPress Reference","slug":"wordpress-reference"},"_links":{"self":[{"href":"https:\/\/chubes.net\/wp-json\/wp\/v2\/documentation\/5803","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/chubes.net\/wp-json\/wp\/v2\/documentation"}],"about":[{"href":"https:\/\/chubes.net\/wp-json\/wp\/v2\/types\/documentation"}],"version-history":[{"count":3,"href":"https:\/\/chubes.net\/wp-json\/wp\/v2\/documentation\/5803\/revisions"}],"predecessor-version":[{"id":10979,"href":"https:\/\/chubes.net\/wp-json\/wp\/v2\/documentation\/5803\/revisions\/10979"}],"wp:attachment":[{"href":"https:\/\/chubes.net\/wp-json\/wp\/v2\/media?parent=5803"}],"wp:term":[{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/chubes.net\/wp-json\/wp\/v2\/tags?post=5803"},{"taxonomy":"project","embeddable":true,"href":"https:\/\/chubes.net\/wp-json\/wp\/v2\/project?post=5803"},{"taxonomy":"project_type","embeddable":true,"href":"https:\/\/chubes.net\/wp-json\/wp\/v2\/project_type?post=5803"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}