The WordPress software package contains many different files and directories.
Although you don’t normally need to download the package from the WordPress website and then upload it to your hosting space it is still important to have an understanding of the core WordPress files and the file structure.
In this tutorial we are going to look at how these files are organised, and also look at some of the more important files.
What You Will Learn
- Where WordPress stores images and other media that you upload.
- Where WordPress stores themes and plugins
- Where the WordPress configuration file is located.
Viewing The WordPress Files
You can either view them on your website by using an FTP client or alternatively download a WordPress package from the WordPress website and unzip it to a folder on your computer.
The screen shot below show the WordPress root directory:
Notice the three sub directories
wp-admin – contains admin php files and not normally changed by users or developers
wp-includes– Contains WordPress core files and not normally changed by users or developers.
wp-content– Contains your themes,plugins and uploaded content and changed when you add media,plugins and themes.
The wp-config.php file is the configuration file that you edit before you do an install. If you do a scripted install then the install scripts will edit this file for you.
Th index.php is the entrance into WordPress and starts the WordPress load process which displays your web pages.
The WordPress .httacces File
Missing from the screen shot is the .htaccess file as this is created by the install process.
If you are viewing these files using ftp then they you may not see this file as it is often hidden. See .htaccess file overview
The Index.php File
This page is the entry page to the entire site.
Every time anyone request a page from your site they call the index.php file.
This file then begins the load process to display the requested page. See Understanding the WordPress load Process.
The wp-config.php File
This is the configuration file for WordPress. A sample file is included with the WordPress package (wp-config-sample.php) which you need to copy,rename to wp-config.php and edit before you run the WordPress install script. See Understanding and Editing the wp-config.php File
The wp-contents Directory
This is probably the most important one, and it is the one that gets changed the most often .
Below is a screen shot of the wp-contents directory and sub-directories:
Notice the wp-contents folder contains three sub directories
- plugins – Stores all your plugins
- themes –Stores all your themes
- languages – Stores language files (I assume)
However a fourth called uploads will also be present on a live system when you upload any media files.
The screen shot also shows the plugins and theme directories expanded.
1. Only the default themes and plugins are shown, as the screen shot was taken using the installation package, and not from a live system that had installed additional themes or plugins.
2. Each theme has its own folder.
3. Plugins have a folder if there are multiple files, but some simple plugins only have a single php file .eg. hello.php
3. Every directory and sub directory has an index.php file. Most aren’t really used. The important ones are the index.php in the root and the index.php in each of the theme directories.
Uploading Files to WordPress
Uploading images and documents to WordPress is usually done using the WordPress Media manager.
Using the media manager will make them accessible via the WordPress control panel.
Files uploaded using the media manager are placed in the uploads folder. See WordPress Media uploads and storage.
However if you need to upload plugins, themes or other files manually then you will need to use an FTP client or a WordPress File Manager.
WordPress File Manager Plugin
There is a File Manager plugin available that will let you upload files into other folder other than the uploads folder from the WordPress Control panel.
I don’t use it as I prefer to use FTP.
You need to be very careful when moving, deleting and adding files on a WordPress site.
Common Questions and Answers
Q-How do I FTP to my WordPress Site?
A- You will need to install an FTP client like FileZilla see Uploading files to a website for more details
Q- Where are my Pages stored in WordPress files?
A- They aren’t stored in the file system they are stored in the database.
Q- Do I need to backup these files and folders?
A- Yes even though many files don’t change except when you do upgrades they should still be part of your backup schedule as they contain your uploaded media. See Backing up and restoring WordPress
Related Tutorials and Resources:
- WordPress installation files and file structure video
- Understanding the WordPress Query-Beginners Guide
- WordPress File And Directory Structure Explained
- PHP Callbacks and Callback Functions
- Beginners Guide to WordPress Templates
- Beginners Guide to the WordPress Loop
- The WordPress Load Process-Beginners Guide
- Understanding and Editing the wp-config.php File