Support » Fixing WordPress » post_date_gmt fix

  • Upgrading from 1.02 to 1.2 introduces a post_date_gmt row for the wp_posts table. The upgrade script creates this row as needed, and it’s supposed to add GMT dates for all existing posts. Except that it doesn’t.
    The fix is easy: remove the exclamation point on line 747.
    Line 747 of wp-admin/upgrade-functions.php:
    if (!$got_gmt_fields) {
    Change it to:
    if ($got_gmt_fields) {

Viewing 5 replies - 1 through 5 (of 5 total)
  • Moderator Matt Mullenweg



    Wouldn’t this cause the times to be adjusted every time upgrade.php is run?

    Yes, as a matter of fact it would. But since most folks will only be upgrading once (from their current install to 1.2 stable), you should have time to develop a better solution for 1.3! =)

    Moderator Matt Mullenweg



    That’s not acceptable. We need to find out why it thinks the dates have been updated already.

    I have that line on line 762 (5/5 nightly). I’m not 100% on this as it’s late and this isn’t my code, but it appears to me that $got_gmt_fields is set to zero on line 762, and then line 762 is checking to see if the variable is null or not set. Correct me if I’m wrong, but I think the zero in there sets the variable.
    I checked on this because all my GMT times in my imported entries are all set to default 0000’s and I’d like to get them set properly, but I don’t think this is the issue.

    michel_v’s fix in the 1.2 delta which checks the MAX value of post_date_gmt appears to work properly. Upgrading from 1.02 to 1.2 delta correctly creates GMT times for upgraded posts.
    Keep up the great work!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘post_date_gmt fix’ is closed to new replies.