Post and page guids include the full absolute URL of my site (e.g. http://www.example.com/wordpress/?p=1). This causes a problem if the domain, or wordpress path changes, or if I'm viewing the site via its IP address rather its domain, etc.

Problem 1: there are some internal links on my site that are using the guid. I'm guessing this is wrong and I should rewrite the template code to remove references to the guid - correct?

Problem 2: images are inserted into a post using their absolute URL, rather than a relative one. This seems short-sighted, but I'm wondering if there's a reasonable reason for that. Is there a way to change that behaviour?

4 Answers 4


1) The GUID is exactly that -- a GUID. It's used to uniquely identify the post. If you need to link to a post, then use get_permalink( $post_ID ) ($post_ID is optional) (link: get_permalink).

2) Not without a plugin, no. There's talk of using an image shortcode for 3.1 though, or maybe 3.2.

In the meantime, you can try using an alpha version of my Regenerate Thumbnails plugin:


It'll go through all of your posts and update all image tags.

Make sure you back up your database first though. The code is alpha and not guaranteed to work, although I have tested it quite a bit.

  • 1) Yes, that's exactly what I'm doing (now) 2) I'll check out your plugin - thanks. One issue surrounds the upload directory location and how that behaves if changed - I need to read up on that and understand it!
    – Bobby Jack
    Commented Sep 8, 2010 at 8:59

Problem 1: Yes, you should not use the guid in the template code. See this recent thread from the wp-hackers mailing-list:


Problem 2: This question is actually one of the most discussed. :)




1.) GUID's in WordPress primarily exist for RSS readers. They are supposed to be unique identifiers so RSS feeds don't republish the same content over and over again. They are not designed to be used within WordPress posts or pages. Even though they may look like permalinks, they aren't and should never be confused with them.

For this reason, the URL part of the GUID should never be changed. If you change domains the GUID shouldn't be updated. The feeds have gone out under the old domain, not the new one, so changing the URI in the database will just annoy your readers, who will see old content being churned out all over again.

2.) Images can be made root-relative by editing the path when you insert them. If you need to change old images, backup your database and grab the Search Regex plugin. Searching in content for scr should show all the images used in your content.

For best performance cross-browser its wise to set base href in your .htaccess file to your site root if you are using relative links.


The problem with Wordpress GUID is that they look the same as URL - so some smart-asses decided to use them for url - the guids should better be some random numbers or something similar...

  • 1
    I'd say that is confusing but hardly a problem. URLs makes sense as easy and relatively reliable unique identifier and it's not uncommon to see them used as such.
    – Rarst
    Commented Apr 27, 2011 at 10:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.