I'm working on a wordpress website for my friends bussines and I'm working on it on my personal server to then export it and import it on his server when it's done.

And one some of the pages I've added som buttons that links to other pages on this website.

It's basially using the code: [button link="".

However my problem is when it's moved to my friends server it's going to be under a different URL than the one I'm working one, which menas that the current link of the button won't work.

Is there any type of code that I could use to use the siteurl?

So basically when the site is hosted on a other URL it will use that URL instead.

Hope this made sense!

Cheers thanks! :)

  • 1
    See: codex.wordpress.org/… – cybmeta Mar 26 '14 at 10:22
  • Never ever hardcode URL's into your template files. You should always use relative paths. – Pieter Goosen Mar 26 '14 at 10:56
  • Then my question is have I would do this. The problem is the that only the main url changes, the permalink etc doesn't change. – Mr Riksson Mar 26 '14 at 10:58

I have a development site as a subdomain of my main site, so I deal with this when I copy data from the live site to the development site to obtain a current version of the development site.

First, visit http://codex.wordpress.org/Moving_WordPress#When_Your_Domain_Name_or_URLs_Change like cybnet recommended. Once you have changed the wp-config files as described in the link, visit https://interconnectit.com/products/search-and-replace-for-wordpress-databases/ and download their php script which will replace the orl urls with the new one.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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