Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am not sure when this started happening as I have not been paying close attention. I've tried disabling recent plugins to no avail. Some of my images are just gone and there doesn't seem to be a pattern to which ones, but when I copy the image location, I get a url that is something like this: http://www.pureplantessentials.comhttp//www.pureplantessentials.com/bruce_lipton1.jpg

when it should be something like this: http://www.pureplantessentials.com/bruce_lipton1.jpg

I looked in the code and it says the image url is: /bruce_lipton1.jpg

You can probably guess my site's url. What could be happening here?

share|improve this question
    
Is this happening on featured images, inserted images, header images, all images? Not a lot of information to do go on here. –  Stephen Jan 12 '13 at 23:03

2 Answers 2

Use the home_url template tag to construct your image urls, e.g.:

<img src="<?php echo home_url( '/bruce_lipton1.jpg' ); ?>" />
share|improve this answer
    
Thank you for the answer and maybe that is something I should have been doing all along, but I have over 700 pages and am not going to go through each to change the image url –  christian Jan 12 '13 at 22:58

You are using relative URLs in some places. That is, you are using this-- <img src="/bruce_lipton1.jpg" />-- instead of this-- <img src="http://www.pureplantessentials.com/bruce_lipton1.jpg" />. Don't do that.

Relative URLs are very unreliable in most of WordPress. It has to do with the way that WordPress rewrites URLs. Your theme, for example, is at wp-content/themes/theme-name/ but those theme files appear to load at any number of places such as http://www.pureplantessentials.com/ or http://www.pureplantessentials.com/contactus/

Use complete URLs by means of bloginfo, any of these, get_template_directory_uri, or get_stylesheet_directory_uri, depending on what you need.

In fact, your image and URL conventions are not consistent. You seem to be keeping images in many different places and you sometimes use absolute URLs and sometimes relative ones. I'd recommend sticking to one consistent pattern.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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