[wp-hackers] GUID problem

Lynne Pope lynne.pope at gmail.com
Thu Sep 2 01:14:50 UTC 2010


On Thu, Sep 2, 2010 at 4:26 AM, Eric Mann <eric at eamann.com> wrote:

> This is the problem inherent in using a URL as a GUID.  Even though
> multiple
> posts might have the same post number (?p=57) I doubt they have the same
> full
> GUID.  Try not to think of the GUID as a URL, even though it *looks* like a
> URL.
>  http://blog.url/?p=57 and http://localhost/?p=57 really are different
> GUIDs
> that refer to different posts ... even if one is post ID 57 and one is post
> ID
> 192, the GUID doesn't change.
>
> For this reason, you shouldn't use the GUID as a short URL ... since the
> GUID
> itself is a URL.  So I don't know what exact use case your client wants,
> but
>  that doesn't make sense.
>

Their site has GUID's containing domain names they no longer control, so
they wanted http://notmydomain.com changed to their domain. This leaves
multiple non-unique GUID's.
They had contracted someone to write a function to generate shortlinks - he
used the GUID. The rationale, apparently, was that the post ID's were also
not unique and over the years their various data imports had left them with
long post ID's.
It appears that when WordPress imports data through the backend post import,
it automatically builds ID's in blocks of 100. So, although they only have
just over 1,000 posts, the post ID's are in the five-figures.

If WordPress intends to change to UUID's in the future I can use that
information to persuade them of the dangers of using the GUID in the
shortlink. But, as it is, a developer has used them for his shortlinks and I
am just tasked with the job of cleaning up the database.

I guess most people wouldn't be keeping blogs going for years on end, and
taking them through different domains and staging processes. But in this
case, the post ID's and GUID's have turned into a real mess.

Lynne


More information about the wp-hackers mailing list