Make WordPress Core

Opened 14 years ago

Closed 9 years ago

#15946 closed defect (bug) (fixed)

post_date_gmt ignored in wp_insert_post()

Reported by: kawauso's profile kawauso Owned by: wonderboymusic's profile wonderboymusic
Milestone: 4.4 Priority: normal
Severity: normal Version: 3.1
Component: Posts, Post Types Keywords: has-patch dev-feedback
Focuses: Cc:

Description

If a post is inserted with post_date_gmt set and post_date not, post_date defaults to the current date/time, rather than being generated from post_date_gmt

Attachments (3)

15946.diff (1.2 KB) - added by kawauso 14 years ago.
Generate post date from GMT if present and remove redundant part of if() clause
15946.2.diff (2.2 KB) - added by oso96_2000 11 years ago.
Refreshed patch with unit test
15946.3.diff (2.2 KB) - added by oso96_2000 9 years ago.
Refreshed patch

Download all attachments as: .zip

Change History (9)

@kawauso
14 years ago

Generate post date from GMT if present and remove redundant part of if() clause

#1 @nacin
14 years ago

  • Milestone changed from Awaiting Review to Future Release

#2 @nacin
11 years ago

  • Component changed from General to Post Types

@oso96_2000
11 years ago

Refreshed patch with unit test

#3 @oso96_2000
11 years ago

  • Keywords dev-feedback added

Hello @kawauso! Thanks for the patch, sorry fort aking too long to respond. I refreshed it and added a unit test.

#4 @wonderboymusic
9 years ago

  • Keywords needs-refresh added
  • Milestone changed from Future Release to 4.4

@oso96_2000
9 years ago

Refreshed patch

#5 @oso96_2000
9 years ago

  • Keywords needs-refresh removed

I removed the $updated part from old patches in the new one. Tests for post group seems to run fine.

#6 @wonderboymusic
9 years ago

  • Owner set to wonderboymusic
  • Resolution set to fixed
  • Status changed from new to closed

In 34762:

Posts: In wp_insert_post(), don't set post_date to current time if it can be derived from a passed value for post_date_gmt.

Adds unit tests.

Props oso96_2000, kawauso.
Fixes #15946.

Note: See TracTickets for help on using tickets.