wp_handle_comment_submission

SummerySummery

Handles the submission of a comment, usually posted to wp-comments-post.php via a comment form.

Syntax

wp_handle_comment_submission( array $comment_data )

DescriptionDescription

This function expects unslashed data, as opposed to functions such as wp_new_comment() which expect slashed data.

ParametersParameters

$comment_data

(array) (Required) Comment data.

  • 'comment_post_ID'
    (string|int) The ID of the post that relates to the comment.
  • 'author'
    (string) The name of the comment author.
  • 'email'
    (string) The comment author email address.
  • 'url'
    (string) The comment author URL.
  • 'comment'
    (string) The content of the comment.
  • 'comment_parent'
    (string|int) The ID of this comment's parent, if any. Default 0.
  • '_wp_unfiltered_html_comment'
    (string) The nonce value for allowing unfiltered HTML.

ReturnReturn

(WP_Comment|WP_Error) A WP_Comment object on success, a WP_Error object on failure.

SourceSource

File: wp-includes/comment.php


			

ChangelogChangelog

Changelog
Version Description
4.4.0 Introduced.
Scroll to Top