WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 5 years ago

#31012 closed enhancement (duplicate)

In wp_new_comment check for presence of $_SERVER['REMOTE_ADDR']

Reported by: rachelbaker Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Comments Keywords: dev-feedback
Focuses: Cc:

Description

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

Change History (1)

#1 @SergeyBiryukov
5 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #14601.

Note: See TracTickets for help on using tickets.