WordPress platform is built to be customized. It’s really one of the most user-friendly solutions in any field. So it’s necessary for all WordPress users to have at least some knowledge of how the WordPress core works to navigate your WordPress website.
Getting used to existing WordPress directories/files & knowing their role is vital in developing maintainable solutions. Understanding the WordPress file and folder structure is a stepping stone towards learning more about WordPress.
The WordPress software package has many different directories & files. You don’t normally need to download the package from the WordPress site & then upload it to your hosting space. But it’s still important to have an understanding of the core WordPress files & file structure.
Today, we’re going to describe the WordPress root folder and file structure in detail. Also, we’ll review the contents of the most important WordPress folders, paying special attention to the core files that power your website.
Let’s hop in!
- Why Learn about WordPress Files & Directory Structure
- WordPress Files & Databases
- Access WordPress Files & Directories
- WordPress Configuration Files
- Inside wp-content Folder
Why You Should Learn about WordPress File & Directory Structure?
Most WordPress users run their WordPress website without ever learning about WordPress directories or files. However, understanding how WordPress stores files & directories can help you solve many WordPress problems on your own.
This guide will help you:
- Understand how WordPress stores your images & media uploads.
- Learn which WordPress folders and files are the core.
- Where configuration files are stored on your WordPress site.
- Where WordPress stores your plugins and themes.
This information also helps you to perform troubleshooting tasks like deactivating all WordPress plugins, switching to a default theme, or fixing other common WordPress errors.
What are WordPress Files and Databases?
To understand the WordPress file and folder structure, let’s take a look at the files of WordPress. WordPress can be thought of as follows: codes, upload, and configurations.
Codes to WordPress websites are what bricks are to a building. Basically, codes can be divided into three parts – Core, Plugins, and Themes. Core, Themes & Plugins work in tandem to create your website.
The core is the heart of a WordPress website. The most important files of the CMS are stored in the core. WordPress has got three Core files – wp-content, wp-admin, wp-includes. Any sort of modification in the core could break your website.
Themes and Plugins help design your WordPress website in any way you desire. When you install a plugin on your WordPress website, it is stored in a file called Plugins. And your themes are stored in a file called Themes.
When you write any post with images, it becomes a part of WordPress. The images are uploaded & stored as a file and that file is called uploads.
This folder has configuration files like wp-config that helps connect the files to the database.
But what is a database? The database is simply like a cupboard where things are stored. Everything from comments to posts on your WordPress website is stored in the mysql database.
To access your database, you’ll have to visit your web host account. You need to log in to your web host & go to a page called cPanel. Then you’ll see an option for phpMyAdmin. Select that, and a new page will open.
The tables you’ll see on the page are as follows:
Accessing WordPress Files and Directories
First, you’ll need a FTP client to connect to your WordPress server. There’s an easier alternative to FTP, called File Manager. It’s a web-based application that comes built into the cPanel dashboard of your WordPress hosting account.
After connecting your WordPress website either using FTP or File Manager, you’ll see a file & directory structure that looks like this.
Folders & files in the red squares are the core WordPress files. These are the files & folders that run your WordPress website. You are not supposed to edit those WordPress files on your own.
Here’s a list of some core WordPress files & folders you would see in your WordPress site’s root directory:
- [dir] wp-admin
- [dir] wp-includes
WordPress Configuration Files
Your WordPress root directory has some special configuration files. These configuration files have some important settings related to your WordPress website.
- .htaccess: It’s a server configuration file, WordPress uses it to manage redirects and permalinks.
- Index.php: The index file basically loads & initializes all your WordPress files when a page is requested by a user.
You may need to edit .htaccess or wp-config.php file sometimes. Be very careful when editing these two files. A slight mistake here and there makes your site inaccessible. When editing these two files, do create backup copies on your computer before making any changes.
Depending on how your WordPress website is set up, you may or may not have the following files in your root directory.
- Robots.txt: This file contains instructions for search engine crawlers.
- Favicon.ico: This file is sometimes generated by WordPress hosts.
Inside wp-content Folder
WordPress stores all plugins, themes, and uploads in wp-content folder. It’s generally assumed that you can edit folders & files inside a wp-content folder. However, this is not entirely true.
Let’s take a quick look inside the wp-content folder to understand how it works and what actions you can perform here.
The contents of the wp-content folder may differ from one WordPress website to another. But all WordPress websites usually have these following components:
- [dir] themes
- [dir] uploads
- [dir] plugins
WordPress stores all your theme files in /wp-content/themes/ folder. You can edit a theme file, but it’s not recommended at all. As soon as you update your theme to a newer version, the changes you’ve made earlier would be overwritten during the update.
That’s why it is strongly recommended to create a child theme for WordPress theme customization.
All WordPress plugins you download & install on your website are stored in /wp-content/plugins/ folder. You are not supposed to edit your plugin files directly, unless you wrote the plugin just for your own WordPress website.
In many WordPress guides and tutorials, you’ll see code snippets that you can add to your WordPress website. The proper way to add custom code to your WordPress website is by adding it to functions.php file of your child theme or by creating a site-specific plugin.
WordPress stores all image & media uploads in the /wp-content/uploads/ folder. By default, all uploads are organized in /year/month folders. You can change the default settings by going to Settings > Media and uncheck “Organize my uploads into month and year based folders”. Whenever you’re creating a WordPress backup, you should include the uploads folder.
You can download fresh copies of WordPress core, your installed plugins, and your themes from their sources. But if you lose your uploads folder, it would be very difficult to restore it without a backup. Some other default folders you’ll see in your wp-content directory are:
- Upgrade: It’s a temporary folder created by WordPress during upgrade to a newer version.
- Languages: WordPress stores languages files for non-english WordPress websites in this specific folder.
Many different WordPress plugins may also create their own folders inside your wp-content folder. For example, in the above screenshot, there’s a gallery folder created by Envira Gallery plugin.
These folders contain some important files. For example, the gallery folder will have all your gallery images. It’s suggested that you backup such folders to avoid losing important data.
Other folders have some files that you can safely delete. For example, some of your caching plugins like W3 Total Cache or WP super Cache may store cached files in their own folders.
It might be a bit difficult for you to understand the function of the WordPress directory and file structure in the first attempt. Appropriate knowledge of WordPress’s files and folders structures would be very handy in the future for managing your website or detecting any issue on your site.
Hopefully, this basic guide will help you familiarize yourself with the core files of your site. If you’ve got any questions related to WordPress files and directory structure, then you can ask us in the comment section below. We appreciate your comments and suggestions.