Image Default Location for WordPress

Posting images in WordPress is easy enough, but you have to know the path the the image directory for the images to appear in your posts. Duh!

Using a local install of WordPress for developing new themes I tried to add an image folder to the theme directory of the current theme. Images did not appear in the posts. That makes sense because the images in posts are independent of the theme you are currently using. Changing a theme for the blog’s look would require using a different theme directory and therefore, it would make no sense to use the current theme directory to store images for the entire blog.

A suitable location for WP images is a new directory inside the wordpress directory in htdocs when running XAMPP, not inside the WordPress theme directory.

With an image directory called “img” the relative path to images would be img/filename.jpg for example.

The path on my machine is C:\xampp\htdocs\wordpress\img\filename.jpg.

The properties of a displayed image show http://localhost/wordpress/img/filename.jpg as the image’s url.

Images for posts cannot be found with Firefox using relative addresses, at least on my local XAMMP setup on Vista Home Premium. Instead, use the absolute URL for images placed in your own image folder in the wordpress directory.

4 thoughts on “Image Default Location for WordPress”

  1. Thank you!! Thank you!!! Thank you!!!!
    As a beginner to WP, this info was very useful!!

Leave a Reply

Your email address will not be published. Required fields are marked *