WordPress is a content management system written in PHP and comes with many files and folders. If you uploaded the files yourself when you installed the system or later take a look at the file and folder structure via FTP, you might wonder which file is responsible for what purpose and where the content of your website is stored. In this article we will explain the file and folder structure in WordPress in detail.
Overview of all WordPress files and directories
In most cases, you can easily run a WordPress site without ever having to familiarize yourself with WordPress files or directories. For most features you can use the user interface. However, if you understand how WordPress stores files and directories, you can solve many WordPress problems with a slightly higher technical complexity by yourself.
You see the following list of files and folders in the root directory of your WordPress installation:
These files can be categorized into four groups: WordPress configuration files, content, plugin and theme files and WordPress core system files. You find detailed explanations in the sections below.
The WordPress core system files are all files that are not explicitly mentioned below as files from another group. They contain the code for all core WordPress features. You should never modify them, because every time you update your WordPress system, the core WordPress system files are replaced with its new version and your changes are lost.
WordPress configuration files
WordPress and its plugins store most configurations in their database. You can therefore easily change them in the web interface of the CMS. However, some configurations are stored outside the database, e.g. the access data for the database itself or configurations that are used by your web server.
In a standard WordPress setup you have the following configuration files:
.htaccess: configuration file, which defines in your Apache2 webserver (mostly managed by your webhoster) the permalinks you defined in Settings > Permalinks and redirections (via plugins).
wp-config.php: Defines all global technical settings for your WordPress, including the connection data to the MySQL/MariaDB database that your WordPress website uses to store a lot of content. Sometimes WordPress plugins use these settings to store API keys by you as administrator.
Content, plugins, themes and more inside the wp-content/ folder
The most important folder for you as a user is
wp-content/. It contains all files that you, your plugins or your themes upload or create. The folder is persistent. This means that it will not be overwritten even if you update your WordPress core system.
wp-content/ folder you will find the following folder structure. Not all of these folders are always present, because it depends on your usage and the technical parameters of your web hosting which folders are needed:
languages/: All translations for your core WordPress system (even English translations) and translations of plugins and themes you use if the developer follows the translation standards for so-called Portable Objects (PO files).
maintenance/: Some web hosting control panels, such as Plesk, use these folders and a maintenance.php file to define how the website looks when the administrator of the WordPress site is doing maintenance (e.g. updating WordPress).
plugins/: All installed plugins for your WordPress site, whether enabled or disabled. Most plugins have their own folder and the structure of each plugin looks different. But every simple plugin can also be just a file.
themes/: All installed themes for your WordPress website, both currently used and (not yet) used themes. Each theme has its own folder. You can also create so-called child themes inside this folder. If you want to change the code of your WordPress theme, it is highly recommended to use child themes, because when you update a theme, its folder get replaced by the new version and all your changes will be lost.
upgrade/: Used temporarily from your WordPress system when you update the WordPress core, a theme or a plugin. Normally the folder is empty, but in the rare case of a failed update, it may contain unused files from the update.
uploads/: All uploads in your WordPress Media Library (e.g. images, videos, audio, PDFs). The folder itself has a folder structure for all uploads that depends on your permalink settings. In addition to the uploaded file, this folder also contains several variants of the same file (e.g. logo-devowl.io.png, logo-devowl.io-150×150.png, logo-devowl.io-300×97.png, logo-devowl.io-510×193.png). This happens because WordPress automatically resizes all your uploaded images to present them in an optimal size. If you only want to export the original files from your WordPress Media Library, read our article How to download/export the WordPress Media Library?.
- Plugin specific folders, e.g.
w3tc-config/: Some plugins add their own folders, e.g. caching plugins to store the cached assets. What purpose the folders serve, if any, can be determined from the documentation of each plugin you have installed.
Where are my posts and pages stored?
You may have noticed that in all these folders there are no articles, pages or content from custom post types (despite uploads to the WordPress Media Library). The reason for this is that all these contents are stored in the database. This is technically more efficient and gives you additional options, such as viewing all old revisions of your content.
If you are further interested in the structure of this kind of data, check out our article Where are pages stored in WordPress?.