[wp-trac] [WordPress Trac] #31012: In wp_new_comment check for presence of $_SERVER['REMOTE_ADDR']

WordPress Trac noreply at wordpress.org
Wed Jan 14 17:06:09 UTC 2015


#31012: In wp_new_comment check for presence of $_SERVER['REMOTE_ADDR']
-------------------------+-----------------------------
 Reporter:  rachelbaker  |      Owner:
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  Comments     |    Version:
 Severity:  normal       |   Keywords:  dev-feedback
  Focuses:               |
-------------------------+-----------------------------
 To create comments with the WP REST API, we would like to use
 `wp_new_comment()`.  This would allow us to take advantage of the filters,
 actions, and notifications already baked into `wp_new_comment()`.

 'wp_new_comment()' does not allow the passing of 'comment_author_IP' and
 only sets the value from `$_SERVER["REMOTE_ADDR"]`.

 For API use the `REMOTE_ADDR` attribute would not be reliable or
 populated, and will trigger a PHP Notice of Undefined Index.

 https://core.trac.wordpress.org/browser/tags/4.1/src/wp-
 includes/comment.php#L2073

--
Ticket URL: <https://core.trac.wordpress.org/ticket/31012>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list