[wp-hackers] updating guid when changing permalinks

Sam Angove sam at rephrase.net
Sun Jul 9 05:53:27 GMT 2006


On 7/9/06, Mike Purvis <mike at uwmike.com> wrote:
>
> Wordpress already keeps an id field that identifies posts... I would
> have thought a good guid would be something more like
> "354 at mysite.com/myblog/"
>

In this case, the GUID is used for the <atom:id> element, which must
be a valid IRI (URI in Atom 0.3). "354 at mysite.com/myblog/" isn't
valid, but both WordPress's URLs and Typo's URNs are. It's easier to
use the URL than to bother with generating a valid URI some other way.
That the slug can change is definitely a problem, though.

That particular scheme also isn't great because post IDs aren't always
preserved when changing publishing systems. IIRC the WordPress
importers discard them in favour of MySQL auto_increment values, for
example.

Mark Pilgrim wrote an article a few years ago on producing Atom IDs
with `tag:` URIs which covers this:

   http://diveintomark.org/archives/2004/05/28/howto-atom-id

It's worth the read. :)


More information about the wp-hackers mailing list