WPDev.one
Core Function
View Source on Trac ↗

wp_new_comment()

wp_new_comment( mixed $commentdata, mixed $wp_error = false )

Adds a new comment to the database.

Parameters 2 required

Name / Type Description
array

$commentdata { Comment data.

Required
bool

$wp_error Should errors be returned as WP_Error objects instead of executing wp_die()? Default false.

Required

Return Value

((int)
| false | WP_Error) The ID of the comment on success, false or WP_Error on failure.

Function Information

Since Version
1.5.0
Source File
wp-includes/comment.php
Advertisement