[wp-hackers] on the role of guid

Fabrizio Regini freegenie at gmail.com
Wed Jun 5 10:27:07 UTC 2013


I found this old post:

http://lists.automattic.com/pipermail/wp-hackers/2011-May/039280.html

I don't know if it has been further discussed, anyway I think a good way 
to generate unique GUID is to generate a hash from the post URL plus a 
timestamp. In this way even if the domain is reused by somebody else on 
a later time, the guid would remain unique due to the dimestamp. For 
additional uniqueness, the post body can be included in the hash. Of 
course, this step is to be taken only on create.

-f

Fabrizio Regini wrote:
> Hi everybody,
> I  was looking for info about the guid field in wp_posts and I 
> stumbled on this page, which states that you should never-ever change 
> the guid field even if you change your site's domain.
>
> http://codex.wordpress.org/Changing_The_Site_URL#Important_GUID_Note
>
> I've recently started to hack around some wordpress plugins, and I 
> noted that at least one of those I encountered rely on the guid field 
> as a source of redirect.
> As I understand this is clearly in contrast with guidelines as 
> described in the above page. If the guid field is to be used as a 
> globally unique identifier for the post, wouldn't it be better to rely 
> on a kind of SHA hash?
> Doing that will avoid any wrong use of the guid field by less informed 
> plugin developers.
>
> What do you think?
>
> -f


More information about the wp-hackers mailing list