Support » Fixing WordPress » Change URL's when uploading to server?

  • I do apologise folks, I’m sure this question has been asked a thousand times, but its hard to find a specific answer (I can find lots of URL posts, but none answering this specific question)

    I am creating a website on my localhost. So every picture, post, blog etc has a ‘localhost’ URL address.

    When I’m done with my website, and want to put it on my web server… Do I have to go though the ENTIRE site and change all those links manually?

    Surely there has to be another way? I’m sure I’m missing something.

    Thanks in advance for your help.

Viewing 2 replies - 1 through 2 (of 2 total)
  • you can check out this article, but for the future reference just a small hint. add this to your functions.php

    // create shortcode for website's home page adress
    function myUrl($atts, $content = null) {
    		"href" => get_option('home')
    	), $atts));
    	return $href;
    add_shortcode("url", "myUrl");

    Than, when you need to hard-code something you can use

    <a href="[url]/whatever...">

    or with the images that link to your localhost, just change that

    <img src="http://localhost/wp-content/...">


    <img src="[url]/wp-content/...">

    There is probably better way to do that, but this was easiest thing for me. That way you can change your site url without being afraid of hard-coded links

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Change URL's when uploading to server?’ is closed to new replies.