Make WordPress Core


Ignore:
Timestamp:
10/23/2017 10:11:11 PM (7 years ago)
Author:
peterwilsoncc
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-xmlrpc-server.php

    r41927 r41980  
    64886488        $comment_ID = wp_new_comment($commentdata);
    64896489
     6490        if ( is_wp_error( $comment_ID ) ) {
     6491            return $this->pingback_error( 0, $comment_ID->get_error_message() );
     6492        }
     6493
    64906494        /**
    64916495         * Fires after a post pingback has been sent.
Note: See TracChangeset for help on using the changeset viewer.