Respect comment_date and comment_date_gmt params in wp_new_comment().

Props solarissmoke, oso96_2000.
Fixes #14279.

git-svn-id: https://develop.svn.wordpress.org/trunk@31615 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Boone Gorges
2015-03-05 02:59:47 +00:00
parent 1ee4d99972
commit c1b30747d5
2 changed files with 47 additions and 2 deletions

View File

@@ -2212,8 +2212,13 @@ function wp_new_comment( $commentdata ) {
$commentdata['comment_author_IP'] = preg_replace( '/[^0-9a-fA-F:., ]/', '',$_SERVER['REMOTE_ADDR'] );
$commentdata['comment_agent'] = isset( $_SERVER['HTTP_USER_AGENT'] ) ? substr( $_SERVER['HTTP_USER_AGENT'], 0, 254 ) : '';
$commentdata['comment_date'] = current_time('mysql');
$commentdata['comment_date_gmt'] = current_time('mysql', 1);
if ( empty( $commentdata['comment_date'] ) ) {
$commentdata['comment_date'] = current_time('mysql');
}
if ( empty( $commentdata['comment_date_gmt'] ) ) {
$commentdata['comment_date_gmt'] = current_time( 'mysql', 1 );
}
$commentdata = wp_filter_comment($commentdata);