WordPress Stores data in two locations:
- A MYSQL database
- The File system
When you upload media e.g. images,videos,documents etc. WordPress automatically places them in a folder on the web server.
Note: Images and other media are not stored in the database with the pages and posts.
Images and other Media files that you upload are stored inside the WordPress file structure.
In this tutorial we will look at how the WordPress files and folders are organised and where the media files i.e images are stored.
What You Will Learn
- Where WordPress stores themes and plugins
- Where WordPress stores images and other media that you upload and how to change the upload folder.
- How to Change WordPress Media Settings.
Understanding WordPress File Structure
The WordPress package contains many different files and directories.
If you look at a WordPress installation you will see a structure very similar to that shown below:
Directly under the root folder you will notice a collection of .php files which includes the index.php file.
The index.php file is the entry point for the site see WordPress Home Page Explained video.
You will also see the three sub directories:
wp-admin folder – contains admin php files which are not normally changed by users or developers.
wp-includes folder– Contains WordPress core php files and not normally changed by users or developers.
wp-content folder– Contains your themes,plugins and uploaded content e.g. pictures and changes when you add media,plugins and themes.
The wp-contents Folder
This is the most important folder as far as we are concerned, and it the one that gets changed the most often .
If you do any manual plugin and theme installs then you will need to locate this directory.
Below is a screen shot of the wp-contents folder and sub-folders:
Notice the wp-contents folder contains several sub folders (directories). The most important ones are:
- plugins – Stores all of your plugins
- themes –Stores all of your themes
- uploads- Stores uploaded media e.g. images
WordPress Media Storage
By default uploaded images and other media files are stored in the uploads folder and sub folders named after the year and month e.g. /wp-content/uploads/year/month/.
I usually deselect the organise my uploads into months and year based folder option and then images and other media are placed directly into the uploads folder.
The media settings specify are three image sizes as shown in the screen shot above.
When you upload images to WordPress, WordPress will auto generate images of different sizes based on these media settings.
This means that a single image file can become 4 files when uploaded as shown below:
Depending on the size of the original image there is a file for:
- The original image
- Small Image
- Medium Image
- Large Image
I normally change my large images to 600 px wide as these can be displayed in most themes.
Changing Image Sizes in Media Settings
If you decide to change the image size settings in media Settings then any new images that are uploaded will use the new size settings.
However existing uploaded images are unaffected and will stay the same size.
To change the existing image sizes you could re-upload the images so that images of the correct size can be generated,
If you have 100s of images then this isn’t really an option, and isn’t really necessary.
If you do need the existing images resized then use the regenerate thumbnails plugin.
WordPress stores uploaded images and media in the file system, but pages and posts are stored in the MYSQL database.
A WordPress installation creates several folders where it stores system files.
Plugins, Themes and uploaded media are all stored under the wp_contents folder.
If you change the media settings the changes only apply to images that you upload following the change.
References and Resources:
- Adding Images to WordPress and WordPress Media
- Backing Up and Restoring WordPress
- Uploading web pages and files using ftp