[wp-trac] [WordPress Trac] #56555: wp_insert_post does not save the post_date for pending posts

WordPress Trac noreply at wordpress.org
Mon Sep 12 08:56:34 UTC 2022


#56555: wp_insert_post does not save the post_date for pending posts
--------------------------+-----------------------------
 Reporter:  sweetheatmn   |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:  6.0.2
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 If we set a date when inserting a post with the status of pending/draft,
 WordPress does not display that date when editing the post


 {{{#!php
 <?php
 // Create post object
 $my_post = array(
                 'post_title'    => 'test title'  ,
                 'post_content'  => 'test content',
                 'post_status'   => 'pending',
                 'post_date' => '2022-09-01 10:38:00',
                 'post_date_gmt' => '2022-09-01 08:38:00'
 );

 // Insert the post into the database
 $id = wp_insert_post( $my_post );
 }}}

 Expected when editing the post to see the set date

  [[Image(https://i.imgur.com/8DSgjCq.png)]]

 current behavior: the date does not display, instead it shows
 "Immediately"

 [[Image(https://i.imgur.com/bGZwCSB.png)]]

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/56555>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list