[wp-trac] [WordPress Trac] #18630: Custom Comment Validation Error

WordPress Trac noreply at wordpress.org
Mon Nov 24 12:21:27 UTC 2014


#18630: Custom Comment Validation Error
-----------------------------+------------------------------
 Reporter:  bandonrandon     |       Owner:
     Type:  feature request  |      Status:  new
 Priority:  normal           |   Milestone:  Awaiting Review
Component:  Comments         |     Version:  3.3
 Severity:  minor            |  Resolution:
 Keywords:  has-patch        |     Focuses:
-----------------------------+------------------------------
Changes (by mdgl):

 * keywords:  needs-patch => has-patch


Comment:

 Patch uploaded that adds an optional parameter to `wp_new_comment()`
 enabling callers to receive a `WP_Error` object return rather than dying.
 This follows the idiom used on `wp_insert_post()` and
 `wp_set_comment_status()` for example.

 The treatment for `check_comment_flood_db()` uses private global variables
 and is rather ugly but I cannot think of a cleaner way of maintaining
 complete backwards compatibility with filter/action order and so on.
 Suggestions for better solutions are welcome!

 With this fix, callers such as `wp-comments-post.php`, `wp-trackback.php`,
 the Ajax admin, XML-RPC and JSON APIs, JetPack and other plugins are now
 able to add comments safely and perform proper reasonable error handling.

 See also #11286, #14452 and #16979.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/18630#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list