Server Time Issues After Upgrading to Wordpress 2.9.1
Posted by webmasterFeb 27
I posted this here because Wordpress was giving me fits. I lost my RSS feeds, ATOM feeds and my post time was being set to UTC-0, which for anyone that knows anything about how the internet works, means that all of my posts were happening in the future.
In other words, lets say I post an article about the Chilean Earthquake at 8:00 am. Well my Wordpress was putting the post time at 4:00 pm, eight hours before it happened.
This wreaks havoc with the Google sitemap and causes Google and all the other search engines to create “unreachable” reports to my articles until 4:00 pm when it can then see that the time stamp on the article has actually passed.
A real pain in my ass I must say. Anyway, I posted the work around below if any of you reading this are having the same problem. To all of my non geek readers, disregard this article. JD AKA Smartass
I ran into a problem that I have not seen mentioned anywhere online. When I initially upgraded to WP 2.9.1 and 2.9.2, I lost my server time synchronization. This also caused my RSS feeds to crash. I noticed that when updating my posts, I would check my XML Sitemaps Generator to make sure that the sitemap was updated and Google and the like were notified.
The time stamp was eight hours ahead to GMT, or Greenwich Mean Time. I live in Los Angeles California, and my servers are located in Spokane Washington. We are in the Pacific Time Zone of the United States, which is UTC-8.
I notified my webmaster of the issue and he assured me that the servers were set to the right time. After a day or so of picking about my site through an FTP client, I stumbled upon a file called WP-Settings.php.
In this file I found the following line,
if ( function_exists(‘date_default_timezone_set’) )
date_default_timezone_set(‘UTC’);
I immediately saw the problem. Although I had set the UTC time to “Los Angeles” in my “General Settings” located in the Wordpress Dashboard, it was being disregarded because of the WP-Setting file was setting the time to straight UTC.
To remedy this problem, I changed the line to read as follows,
if ( function_exists(‘date_default_timezone_set’) )
date_default_timezone_set(‘UTC-8′);
The change being the addition of the “-8″ to the UTC parameter to suggest to Wordpress to put my server time to PST.
I may be a dullard, but I have seen no mention of this anywhere on the internet with the exception of people like me Googling around looking for possible reasons as to why they had suddenly lost server time.
I hope this will help anyone like me struggling to understand all of this.
Tags: chilean earthquake, Google, google sitemap, greenwich mean time, Los Angeles, pacific time zone, RSS, server time, Server Time Issues After Upgrading to Wordpress 2.9.1, smartass, time stamp, time synchronization, United States, utc time, WP-Settings.php, wreaks havoc
JD, you've invented time travel…lol. We need to hit Vegas. Love the site man!
Well it was messing things up for me and the people at wordpress had no mention of it, yet there were all kinds of Google inquiries into why it was happening. So I got lucky and figured it out myself. JD
Persistence pays off. Good thing you didn't have to call some dumb shit in India. Good for you.
I had the same issue and applied almost the same fix – date_default_timezone_set(‘America/Los_Angeles′).
awesome detective work mate! yer tip helped me out bigthyme, gracias
I had almost the same thing happen. I was in a hurry when I updated a couple plug-ins (and didn't read the details, which caused another problem) So, since I needed to remove some WP files from my server I decided to upgrade to 2.9.2. I then discovered the timestamp was off because I have a welcome script on my primary site and the time was several hours in the future. I'm in PDX and my host server is in Salt Lake, so I called to tell them their server needed to be reset & they confirmed their server had the correct timestamp. So, sensing it was a WP issue, I isolated the problem by putting a quick PHP script on my site outside of the WP directory and got a correct timestamp. Found nothing on the WP site about it. But, with some detective work, I stumbled across the culprit. UTC-8 was my fix, too. Glad to see you posted about this bug. FWIW, it's the same in 3.0 beta-1, too. Those two lines of code weren't in the earlier versions.