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:
@@ -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.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user