[wp-hackers] update $wp_query->post->guid fails

Otto otto at ottodestruct.com
Fri Jul 9 20:19:42 UTC 2010

On Fri, Jul 9, 2010 at 2:23 PM, Will Anderson <will at itsananderson.com> wrote:
> Is there a reason why the URL is used? From a GUID definition standpoint,
> the post's address meets the criteria (it should be globally unique [1]),
> but from a user's standpoint, it has a lot of potential for confusion for
> people who are (a) new to the WP DB and (b) don't already know what a GUID
> is.
> I guess what it boils down to is, why isn't something like the PHP uniqid()
> function [2] used instead?
> [1] http://en.wikipedia.org/wiki/Globally_Unique_Identifier
> <http://en.wikipedia.org/wiki/Globally_Unique_Identifier>[2]
> http://www.php.net/manual/en/function.uniqid.php
> <http://www.php.net/manual/en/function.uniqid.php>

In the world of RSS and ATOM feeds, historically, the URLs of the
content have been used as unique identifiers. Reasoning is that most
sites own their own domain and a URL tends to link to one thing only.
Same basic principle leads to the reversed domain pattern for
namespacing in object oriented languages like Java and such. The fact
that you have your own domain means that you can prevent collisions
and that the URL pattern is under your control.

I have argued for using real GUIDs before (using the mySQL UUID()
function[1]). There hasn't been any traction on it because nobody
seems to see any real advantages there. The GUID simply isn't used
much, although it's one of those necessary things for feeds.

The PHP uniqid function won't work because it's not *globally* unique.
The UUID() function in mySQL is.


[1] http://dev.mysql.com/doc/refman/5.1/en/miscellaneous-functions.html#function_uuid

More information about the wp-hackers mailing list