Make sure timestamps are not 0000 when publishing. Props techcookies. fixes #6527
git-svn-id: https://develop.svn.wordpress.org/trunk@8636 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
a8a591310f
commit
c53da5a523
|
@ -1354,14 +1354,14 @@ function wp_insert_post($postarr = array(), $wp_error = false) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the post date is empty (due to having been new or a draft) and status is not 'draft', set date to now
|
// If the post date is empty (due to having been new or a draft) and status is not 'draft', set date to now
|
||||||
if (empty($post_date)) {
|
if ( empty($post_date) || '0000-00-00 00:00:00' == $post_date ) {
|
||||||
if ( !in_array($post_status, array('draft', 'pending')) )
|
if ( !in_array($post_status, array('draft', 'pending')) )
|
||||||
$post_date = current_time('mysql');
|
$post_date = current_time('mysql');
|
||||||
else
|
else
|
||||||
$post_date = '0000-00-00 00:00:00';
|
$post_date = '0000-00-00 00:00:00';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($post_date_gmt)) {
|
if ( empty($post_date_gmt) || '0000-00-00 00:00:00' == $post_date_gmt ) {
|
||||||
if ( !in_array($post_status, array('draft', 'pending')) )
|
if ( !in_array($post_status, array('draft', 'pending')) )
|
||||||
$post_date_gmt = get_gmt_from_date($post_date);
|
$post_date_gmt = get_gmt_from_date($post_date);
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue