Do you want to get acquainted with WordPress files and directory structure?
All WordPress core files, themes, plugins and user uploads are stored on your website hosting server.
In this beginner’s guide, we will explain the file and directory structure in WordPress.
Once you connect to your WordPress site using either FTP or File Manager, you will see a file and directory structure that looks like this :
Inside the root folder, you will see the basic WordPress files and folders. These are the files and folders that run your WordPress site.
Apart from files .htaccess and wp-config.php, you are not supposed to edit other files yourself.
The following is a list of essential WordPress files and folders that you may see in the root directory of your WordPress site.
- wp-admin [dir]
- wp-content [dir]
- wp-includes [dir]
- The wp-config-sample file.php
- The wp-load file.php
- The wp-login file.php
- The WP-mail file.php
- The wp-settings file.php
- The wp-trackback file.php
The above list is missing from the files .htaccess and wp-config.php. That’s because these two files were created after installing WordPress.
WordPress configuration files
Your WordPress root directory contains some special configuration files. These files contain important settings specific to your WordPress site.
- .htaccess-server configuration file, used by WordPress to manage permalinks and redirects .
- wp-config.php-this file tells WordPress how to connect to your database. It also defines some general settings for your WordPress site.
- index.php-the index file basically loads and initializes all your WordPress files when the user requests the page.
You may need to modify the wp-config file.php or .htaccess sometimes. Be very careful when editing these two files. A minor error may result in your site being inaccessible. When editing these two files, always create backup copies on your computer before making any changes.
If you don’t see a file .htaccess is in your root directory, check out our guide on why you can’t find a file .htaccess is in your WordPress root directory.
Depending on how you set up your WordPress site, you may or may not have the following files in your root directory.
- The robots file.txt-contains instructions for search engine crawlers
- Favicon.ico-the favicon file is sometimes created by WordPress hosts.
Inside the wp-content folder
WordPress stores all uploads, extensions and templates in the wp-content folder.
It is generally assumed that you can edit files and folders inside the 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.
The contents of the wp-content folder may vary from one WordPress site to another. But all WordPress sites usually have the following :
- [dir] themes
- [dir] plugins
- [dir] uploads
WordPress stores your theme files in the
/wp-content/themes/ folder. You can edit a theme file, but it is generally not recommended. Once you update your theme to a newer version, your changes will be overwritten during the update.
That is why it is recommended to create a sub-theme to customize the WordPress theme.
All WordPress plugins that 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 write a 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 a custom icon to your WordPress site is to add it to the function file.your child’s theme php or by creating a site-specific plugin . Alternately, you can also use the plugin for custom code snippets to add custom code.
WordPress stores all image and media uploads in the /wp-content/uploads / folder. By default, uploads are organized in
/year/month/ folders. When you create a backup of WordPress, you must include the Downloads folder.
You can download recent copies of the WordPress kernel, your theme and installed plugins from their sources. But if you lose the Downloads folder, it will be very difficult to restore it without a backup.
Some other default folders you may see in the wp-content directory.
- Languages-WordPress stores the language files for non-English WordPress sites in this folder.
- Upgrade-this is a temporary folder created by WordPress while upgrading to a newer version .
Many WordPress plugins may also create their own folders inside the wp-content folder to store files.
Some WordPress plugins may create folders inside the
/wp-content/uploads/ folder to save user uploads. For example, this demo website contains folders created by the plugins Smash Balloon, WooCommerce, SeedProd and WPForms .
Some of these folders may contain important files. That is why we recommend backing up all these folders as a precaution.
Other folders may contain files that you can safely delete. For example, additional caching components such as WP Rocket may create folders to save caching data.
That’s all, we hope this article helped you understand the structure of the WordPress directory and file.