Circumventing the normal image upload process

If the question is “Why don’t my images load?” the answer is “Don’t use relative URLs in a WordPress context.”

Use functions like admin_url and these other related functions instead.

Relative URLs are relative to the URL of the page you are on, and are calculated by the browser. In other words, relative URLs are relative the URL as the (client-side) browser see it. With static HTML sites that more or less maps to the filesystem paths, and it works fine. With generated URL structures like WordPress creates that doesn’t work.

Think about http://example.com/category/aciform. In WordPress, there is no file at that location, yet that is the base for calculating the relative URL. It makes them very unreliable.

Related

http://yoast.com/relative-urls-issues/

Leave a Comment