[wp-hackers] Avoiding GUID collisions

Lynne Pope lynne.pope at gmail.com
Sun Feb 1 06:25:05 GMT 2009

Hi all,
Anyone know of any way to avoid issues with WP's guid's? Also, how to avoid
issues with feeds if the guid's are changed?

Note - I am looking for a code solution, not support for fixing a user

I encountered some issues with this scenario...

4 x blogs, all created locally then uploaded to the server.
Time passed, I decided to take down 3 blogs and move some content from each
of these into blog #4.
guid's of http://localhost/blog/?p=ID were not a problem on each individual
blog. However, on pulling the posts into the last blog I found that this URI
was duplicated and sometimes triplicated.

This defeats the purpose of a GUID, which should be a unique identifier.

I've run an SQL query to change all guid's to the new domain with the ID
taken from the post ID. This recreates a unique guid but I am unsure of the
implications for feeds.

The blogs I took down had content dating way back, and had come from
b2\cafelog and Nuke before that. Due to the massive amount of data I didn't
attempt to combine the databases to keep ID's soomewhat related to date
order. And due to the revisions in WP 2.6, the ID's climbed exponentially.
This means that ID's for recent content from blog 1 are in some cases
considerably lower than ID's for old content from blog 2.

With the change to the GUID is this likely to see the feeds from the new
domain throwing out really old content now?

Apart from that issue, I am concerned that sites I develop locally for
clients could run into the same issues should any clients decided to migrate
content from, say, company blog A and company blog B to company blog C.  If
I have managed to have so-called unique guid's being replicated for
different content others are bound to run into this too.


More information about the wp-hackers mailing list