Understanding WordPress Files and Directories

The core WordPress software, themes, plugins, and user uploads are all stored on our website files and directories.

Why Learn WordPress Files and Directorires structure?

Most novice to experienced users run their WordPress site without ever knowing about WordPress files or directories structure. However, understanding how WordPress stores files and directories will help solve many common problems on our own.

In this tutorial we will,

  1. Learn which files and folders are core files.
  2. Understand how images and other media uploads are stored.
  3. Where themes and plugins are stored.
  4. Where configuration files are stored.
  5. which WordPress files to backup.
  6. Perform troubleshooting tasks like deactivating all plugins, switching to a default theme, or fix other common errors.

Now, let’s take a look at WordPress file and directory structure.

To view WordPress files and directories, you can either connect to your wordpress site using FTP or you can download a fresh WordPress from wordpress.org and extract to the folder of your choice and open the extracted wordpress folder to view the following structure.

WordPress core files

Among those files core WordPress files and folders we would see are,

  • [dir] wp-admin
  • [dir] wp-includes
  • 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
    We are not suppose to edit these files on our own.

WordPress Configuration Files

Any WordPress root directory contains some special configuration files that store important settings specific to our site.
Here are the important configuration files,

  • .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 and also sets some global settings for our website. If you have freshly downloaded the wordpress from wordpress.org you will not see this file. This is created when you install WordPress or you can copy wp-config-sample.php and enter your settings directly.
  • index.php – The index file basically loads and initializes all our WordPress files when a page is requested by a user.

Inside wp-content Folder

WordPress stores all uploads, plugins, and themes in wp-content folder.
It is generally assumed that we can edit files and folders inside wp-content folder. However, this is not entirely true.
Let’s take a look inside wp-content folder to understand how it works and what you can do here.

The contents of 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 our theme files in /wp-content/themes/ folder. We 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 we download and install on our site are stored in /wp-content/plugins/ folder. We are not supposed to edit plugin files directly, unless its our own.
    WordPress stores all our image and media uploads in the /wp-content/uploads/ folder. By default, uploads are organized in /year/month/ folders. Whenever we are creating a WordPress backup, we should include uploads folder.
    We can download fresh copies of WordPress core, our theme, and installed plugins from their sources. But if we lose our uploads folder, then it would be very hard to restore it without a backup.

Some other default folders we may see in our 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 our wp-content folder.
    Some of these folders may contain important files. Wou should always backup such folders to avoid losing important data.
    Other folders may contain files that we can safely delete. For example our caching plugins like W3 Total Cache or WP Super Cache may store cached files in their own folders.

Related Posts

Android Launcher App in React Native

A simple custom Android launcher app built with React Native. Find in GitHub A custom Android Launcher made with ReactNativehttps://github.com/lohanidamodar/RNLauncher10 forks.34 stars.1 open […]

%d bloggers like this: