#22063 closed enhancement (duplicate)
wp_insert_attachment misses proper post_date_gmt filling
Reported by: | thomask | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 3.4.2 |
Component: | Upload | Keywords: | |
Focuses: | Cc: |
Description
wp_insert_post function contains this block
2550 if ( empty($post_date_gmt) || '0000-00-00 00:00:00' == $post_date_gmt ) { 2551 if ( !in_array( $post_status, array( 'draft', 'pending', 'auto-draft' ) ) ) 2552 $post_date_gmt = get_gmt_from_date($post_date); 2553 else 2554 $post_date_gmt = '0000-00-00 00:00:00'; 2555 }
which fills post_date_gmt, when not filled.
this block is missing from wp_insert_attachment function and it fills this column with current date time.
wp_list_table shows date from post_date_gmt so it is then confusing.
P.S.: wouldn't be better to have one function (wp_insert_post) and make wp_insert_attachment just somehow extend it for attachments? IMO they are (should be) 99 % same.
Change History (2)
Note: See
TracTickets for help on using
tickets.
Yup: #21963
That de-duplication will also fix this issue though, so closing as a duplicate of that