WordPress.org

Ready to get started?Download WordPress

Forums

Can I NOT harcode domain name in IMG in Post? (3 posts)

  1. slobizman
    Member
    Posted 9 years ago #

    I do a lot of <img> statements in my blog posts. I'm hardcoding the domain name each time, like:

    img src="http://www.googletutor.com/wp-content/images/something.gif"

    I hate to think about all the changes I'd have to make if I ever changed my domain name. Is there some sort of code I can put in the page that signifies the site URL so I don't have to hard code it?

  2. Kiddeath91
    Member
    Posted 9 years ago #

    Just keep everything in the same directory (wp-content).

    Don't use the absolute URL. Do this:

    img src="/wp-content/images/something.gif"

  3. slobizman
    Member
    Posted 9 years ago #

    Yes!!!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.