Changeset 3074 for trunk/wp-includes/functions-post.php
- Timestamp:
- 11/14/2005 09:56:41 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/functions-post.php
r3011 r3074 55 55 } 56 56 57 if (empty($post_date)) 58 $post_date = current_time('mysql'); 59 if (empty($post_date_gmt)) 60 $post_date_gmt = get_gmt_from_date($post_date); 57 58 // If the post date is empty (due to having been new or a draft) and status is not 'draft', set date to now 59 if (empty($post_date)) { 60 if ( 'draft' != $post_status ) 61 $post_date = current_time('mysql'); 62 } 63 64 if (empty($post_date_gmt)) { 65 if ( 'draft' != $post_status ) 66 $post_date_gmt = get_gmt_from_date($post_date); 67 } 61 68 62 69 if ( empty($comment_status) ) { … … 383 390 $postarr['post_category'] = $post_cats; 384 391 392 // Drafts shouldn't be assigned a date unless explicitly done so by the user 393 if ( 'draft' == $post['post_status'] && empty($postarr['edit_date']) && empty($postarr['post_date']) && 394 ('0000-00-00 00:00:00' == $post['post_date']) ) 395 $clear_date = true; 396 else 397 $clear_date = false; 398 399 // Merge old and new fields with new fields overwriting old ones. 400 $postarr = array_merge($post, $postarr); 401 $postarr['post_category'] = $post_cats; 402 if ( $clear_date ) { 403 $postarr['post_date'] = ''; 404 $postarr['post_date_gmt'] = ''; 405 } 406 385 407 return wp_insert_post($postarr); 386 408 }
Note: See TracChangeset
for help on using the changeset viewer.