Support » Fixing WordPress » GUID and absolute links

  • Resolved StephenEquus

    (@stephenequus)


    We have a staging and a production environment for our site. Recently we added SSL to both environments. Part of my task was to go through and find all absolute links in content and make them relative. Aside from using Better Search and Replace plugin to fix absolute URLs in posts and postmeta I also double-checked the MySQL database. While I was searching I discovered that there are many other assets that use absolute links – such as – GUID. I did an UPDATE and replace in phpMyAdmin of GUIDs in staging (to be staging URL) and in production (to be production URL) without any problems.

    Recently I needed to do a clone of production to staging so work can be done. I checked the staging MySQL database and now the staging GUID URLs are the same as production.

    My question is, should I leave the GUID URLs of staging the same as production or should I go in and change them back to staging? I’m assuming if I change staging GUIDs to staging URL and do my deployment to production – then production GUID URLs become staging URLs. Could I just use the production URL for the staging GUID URLs and call it a day?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hi StephenEquus,
    Yes you can leave GUID URLs of staging same as production as it is not used to link Post.
    So you can keep it as it is.

    Thanks
    Suman W.

    Moderator bcworkz

    (@bcworkz)

    Suman is correct, leaving as is is not a problem. The purpose of GUID is to give a post record a unique identifier. It’s convenient to use permalinks as they are known to be unique. There is no requirement that a permalink be a GUID. It can be anything unique. Some people will incorrectly rely on the GUID field for the permalink. Their code will break if you used an alternative format GUID, but that would be their problem, not yours.

    You shouldn’t even change the GUID at all, ever. It is for RSS readers to know if they’ve read a post yet or not. (There could be other uses.) If you change them, people or services using the feed will be inundated with posts that are marked as new when they are not new.

    Also, I don’t see how you can use relative links in a dynamic HTML page. Unless you mean that it starts with a slash instead of a domain name. But that’s an absolute, not a relative path.

    Thanks for the help everyone. I know what to do now.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘GUID and absolute links’ is closed to new replies.