Do you want to learn about WordPress files and directory structure?
All core WordPress files, themes, plugins, and user uploads are stored on your website hosting server.
In this beginner’s guide, we’ll explain the WordPress file and directory structure.
Why You Should Learn About WordPress File and Directory Structure?
Most users can run their WordPress website without ever learning about WordPress files or directories. However, understanding how WordPress stores files and directories can help you solve many common WordPress problems on your own.
This guide will help you:
- Learn which WordPress files and folders are core files.
- Understand how WordPress stores your images and media uploads.
- Where WordPress stores your themes and plugins.
- Where configuration files are stored on your WordPress install.
This information also helps you learn how WordPress works behind the scenes and which WordPress files should you backup.
Having said that, let’s take a look at the WordPress file and directory structure.
Accessing WordPress Files and Directories
Your WordPress files and directories are stored on your web hosting server. You can access these files by using an FTP client. See our guide on how to use FTP to upload WordPress files for detailed instructions.
An easier alternative to FTP is the File Manager app that comes built into most WordPress hosting control panel.
Once you have connected to your WordPress site either using FTP or File Manager, you will see a file and directory structure that looks like this:
Inside the root folder, you’ll see the core WordPress files and folders. These are the files and folders that run your WordPress site.
Apart from .htaccess and wp-config.php files, you are not supposed to edit other files on your own.
Here is a list of core WordPress files and folders that you would see in your WordPress site’s root directory.
- wp-admin [dir]
- wp-content [dir]
- wp-includes [dir]
- index.php
- license.txt
- readme.html
- wp-activate.php
- wp-blog-header.php
- wp-comments-post.php
- wp-config-sample.php
- wp-cron.php
- wp-links-opml.php
- wp-load.php
- wp-login.php
- wp-mail.php
- wp-settings.php
- wp-signup.php
- wp-trackback.php
- xmlrpc.php
The above list is missing .htaccess and wp-config.php files. That’s because those two files are created after WordPress installation.
WordPress Configuration Files
Your WordPress root directory contains some special configuration files. These files contain important settings specific to your WordPress site.
- .htaccess – A server configuration file, WordPress uses it to manage permalinks and redirects.
- wp-config.php – This file tells WordPress how to connect to your database. It also sets some global settings for your WordPress site.
- index.php – The index file basically loads and initializes all your WordPress files when a page is requested by a user.
You may need to edit wp-config.php or .htaccess file sometimes. Be extra careful when editing these two files. A slight mistake can make your site inaccessible. When editing these two files, always create backup copies on your computer before making any changes.
If you don’t see .htaccess file in your root directory, then checkout our guide on why you can’t find .htaccess file in your WordPress root directory.
Depending on how your WordPress site is setup, you may or may not have the following files in your root directory.
- robots.txt – contains instructions for search engines crawlers
- Favicon.ico – A favicon file is sometimes generated by WordPress hosts.
Inside The wp-content Folder
WordPress stores all uploads, plugins, and themes in the wp-content folder.
It is generally assumed that you can edit files and folders inside wp-content folder. However, this is not entirely true.
Let’s take a look inside the wp-content folder to understand how it works and what you can do here.
Contents of the wp-content folder may differ from one WordPress site to another. But all WordPress sites usually have these:
- [dir] themes
- [dir] plugins
- [dir] uploads
- index.php
WordPress stores your theme files in /wp-content/themes/
folder. You can edit a theme file, but it is generally not recommended. As soon as you update your theme to a newer version, your changes will be overwritten during the update.
This is why it is recommended to create a child theme for WordPress theme customization.
All WordPress plugins you download and install on your site are stored in /wp-content/plugins/ folder. You are not supposed to edit plugin files directly, unless you wrote site-specific WordPress plugin for your own use.
In many WordPress tutorials, you will see code snippets that you can add to your WordPress site.
The best way to add custom code to your WordPress site is by adding it to functions.php file of your child theme or by creating a site-specific plugin. Alternately, you can also use custom code snippets plugin to add custom code.
WordPress stores all your image and media uploads in the /wp-content/uploads/
folder. By default, uploads are organized in /year/month/
folders. Whenever you are creating a WordPress backup, you should include the uploads folder.
You can download fresh copies of WordPress core, your theme, and installed plugins from their sources. But if you lose your uploads folder, then it would be very hard to restore it without a backup.
Some other default folders you may see in your wp-content directory.
- languages – WordPress stores language files for non-english WordPress sites in this folder.
- upgrade – This is a temporary folder created by WordPress during upgrade to a newer version.
Many WordPress plugins may also create their own folders inside your wp-content folder to store files.
Some WordPress plugins may create folders inside the /wp-content/uploads/
folder to save user uploads. For instance, this demo website has folders created by Smash Balloon, WooCommerce, SeedProd, and WPForms plugins.
Some of these folders may contain important files. This is why we recommend backing up all such folders as a precaution.
Other folders may contain files that you can safely delete. For example your caching plugins like WP Rocket may create folders to save caching data.
That’s all, we hope this article helped you understand the WordPress file and directory structure. You may also want to see our beginner’s guide to WordPress database management with phpMyAdmin, and our tutorial on how to create a custom WordPress theme without any coding knowledge.
If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.
The post Beginner’s Guide to WordPress File and Directory Structure first appeared on WPBeginner.