Comments: Check if wp_new_comment() returns an error.

Adds checks throughout to allow for `wp_new_comment()` returning a `WP_Error` instance.

Updates the docs for the `pre_comment_approved` filter to include that it can be passed an error.

Props enrico.sorcinelli, ryotsun.
Fixes #39730.


Built from https://develop.svn.wordpress.org/trunk@41980


git-svn-id: http://core.svn.wordpress.org/trunk@41814 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Peter Wilson
2017-10-23 22:12:51 +00:00
parent 29d213cfbd
commit 339d838475
5 changed files with 20 additions and 4 deletions

View File

@@ -6487,6 +6487,10 @@ class wp_xmlrpc_server extends IXR_Server {
$comment_ID = wp_new_comment($commentdata);
if ( is_wp_error( $comment_ID ) ) {
return $this->pingback_error( 0, $comment_ID->get_error_message() );
}
/**
* Fires after a post pingback has been sent.
*