[wp-hackers] GUID problem

Otto otto at ottodestruct.com
Wed Sep 1 19:25:04 UTC 2010


On Wed, Sep 1, 2010 at 11:03 AM, Lynne Pope <lynne.pope at gmail.com> wrote:
> Hi all,
> The GUID *should* be unique within a blog - right? Well, I have a problem
> and am hoping someone has ideas on how to solve it (apart from manually
> modifying the GUID field).

Actually, the GUID should be unique across the whole of space and
time. It's a "global" identifier. No other blog, or item, anywhere on
the planet should have that identifier.

The use of URLs for this goes way back, but the basic idea is that the
domain name is something that doesn't change often (or, at least
should not change often). So using it as a prefix gives you the basic
uniqueness to the site alone. This same principle is used for naming
conventions for java and other languages that use reverse namespacing,
eg. com.ottodestruct.some.dumb.class as a class name.

So on that level, if you a) didn't move the blog around and b) wrote
the content on the site itself instead of staging it somewhere first,
then the GUID would fulfill it's goals here.

However, many people don't do that. To which I respond that the GUID
doesn't actually matter for most people. It's really only used as a
unique identifier in the feeds, and even then most feed readers don't
rely on it, but use a combination of it, the timestamp, several other
things.

> They want this fixed, and also want to use the GUID as a short URL on their
> new site, which makes it imperative that the GUID really is a unique
> identifier.

Note: You *CANNOT* use the GUID as a shortlink. It is NOT a valid URL,
it is NOT guaranteed to be one, ever. Talk them down from this.

I've been wanting real UUID's in the GUID field for a long time
because of the confusion over this. For reference, a UUID looks like
"8d3fe620-b5fe-11df-8d81-0800200c9a66" or similar.

If they want a shortlink, then use the new 3.0 Shortlink API. The
wp_get_shortlink() function along with a shortlink plugin like
http://wordpress.org/extend/plugins/wp-bitly/ will do the trick for
you.

-Otto


More information about the wp-hackers mailing list