Respect `comment_date` and `comment_date_gmt` params in `wp_new_comment()`.
Props solarissmoke, oso96_2000. Fixes #14279. Built from https://develop.svn.wordpress.org/trunk@31615 git-svn-id: http://core.svn.wordpress.org/trunk@31596 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
8c48f9400e
commit
b3e11db20b
|
@ -2212,8 +2212,13 @@ function wp_new_comment( $commentdata ) {
|
||||||
$commentdata['comment_author_IP'] = preg_replace( '/[^0-9a-fA-F:., ]/', '',$_SERVER['REMOTE_ADDR'] );
|
$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_agent'] = isset( $_SERVER['HTTP_USER_AGENT'] ) ? substr( $_SERVER['HTTP_USER_AGENT'], 0, 254 ) : '';
|
||||||
|
|
||||||
|
if ( empty( $commentdata['comment_date'] ) ) {
|
||||||
$commentdata['comment_date'] = current_time('mysql');
|
$commentdata['comment_date'] = current_time('mysql');
|
||||||
$commentdata['comment_date_gmt'] = current_time('mysql', 1);
|
}
|
||||||
|
|
||||||
|
if ( empty( $commentdata['comment_date_gmt'] ) ) {
|
||||||
|
$commentdata['comment_date_gmt'] = current_time( 'mysql', 1 );
|
||||||
|
}
|
||||||
|
|
||||||
$commentdata = wp_filter_comment($commentdata);
|
$commentdata = wp_filter_comment($commentdata);
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '4.2-alpha-31614';
|
$wp_version = '4.2-alpha-31615';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue