[wp-trac] [WordPress Trac] #22063: wp_insert_attachment misses proper post_date_gmt filling

WordPress Trac wp-trac at lists.automattic.com
Mon Oct 1 00:44:22 UTC 2012


#22063: wp_insert_attachment misses proper post_date_gmt filling
-----------------------------+-------------------------
 Reporter:  thomask          |       Type:  enhancement
   Status:  new              |   Priority:  normal
Milestone:  Awaiting Review  |  Component:  Upload
  Version:  3.4.2            |   Severity:  normal
 Keywords:                   |
-----------------------------+-------------------------
 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.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/22063>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list