[wp-trac] [WordPress Trac] #51289: Documentation issue: get_post_time is getting the time when published not when created

WordPress Trac noreply at wordpress.org
Fri Sep 11 00:55:25 UTC 2020


#51289: Documentation issue: get_post_time is getting the time when published not
when created
--------------------------+-----------------------------
 Reporter:  casiepa       |       Owner:  SergeyBiryukov
     Type:  defect (bug)  |      Status:  reviewing
 Priority:  normal        |   Milestone:  5.6
Component:  Date/Time     |     Version:
 Severity:  normal        |  Resolution:
 Keywords:  has-patch     |     Focuses:  docs
--------------------------+-----------------------------

Comment (by SergeyBiryukov):

 This might need some further clarification, as it's not quite clear what
 "published" means for a draft or pending post.

 In my testing:
 * For a draft post that never was published, `get_the_date()` returns the
 date of the last edit.
 * For a post that was previously published, `get_the_date()` returns the
 published date.

 For both of these cases, the existing docs seem accurate.
 [attachment:"51289.diff"] would only be accurate for the second case.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/51289#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list