Learn about files and directory structure in WordPress

File Structure

Do you want to learn about WordPress files and directory structure? The original WordPress directories, themes, plugins and what users uploads are all stored on your site. In this beginner’s guide, we will explain the files in WordPress and the directory structure.

Why should you learn about WordPress files and directory structure?

Most users can run their WordPress websites without ever having to understand WordPress files or directories. However, knowing how WordPress stores files and folders can help you solve many common WordPress problems yourself.

The following guide will help you:
  • Learn about which WordPress files and directories are the root ones.
  • Understand how WordPress stores images and things you upload.
  • Understand where WordPress hosts themes and plugins.
  • Understand where configuration files are stored on WordPress.
  • This information also helps you understand which WordPress files you need to back up.

You will also be able to fix some problems yourself, such as deactivating all active plugins, reverting to the default theme or fixing common WordPress errors.

Let’s find out about WordPress files and directory structure.

Access WordPress files and folders

First, you will need an FTP client to connect to your WordPress server.

An easier alternative to FTP is File Manager. It is a web-based application that comes with the cPanel dashboard of your WordPress hosting account.

Once you have connected to your WordPress site, use FTP or File Manager, you will see there is a file and folder structure that looks like this:

The files and folders in the red squares are the core WordPress files. These are the files and directories that run the website. You do not have to edit the above files.

Here is a list of WordPress files and core folders in the root directory of your website.

[dir] wp-admin
[dir] wp-includes

WordPress configuration files

Your original WordPress directory contains some special configuration files. These files contain important settings specific to your site

  • .htaccess – A WordPress server configuration file that uses it to manage permalinks and redirects.
  • wp-config.php – this file allows WordPress to connect to the database. It also sets some general settings for the site.
  • index.php – The index file loads and initializes all WordPress files when a page is requested by the user.

Sometimes you will need to edit the wp-config.php or .htaccess file. Be careful when editing these two files. A small mistake can make your site inaccessible. When editing these two files, always create backups on your computer before making any changes.

If you do not see the .htaccess file in the root directory then refer to our guide.

Depending on how your WordPress site is set up, you may or may not have the following files in the root directory.

  • robots.txt – Contains instructions for scanners of search engines
  • Favicon.ico – A favicon file is sometimes generated by WordPress hosts.

Inside the wp-content directory

WordPress stores all your uploads, plugins, and themes in the wp-content directory.

People often think that it is possible to edit files and directories inside the wp-content directory. However, this is not entirely true.

Let’s take a look inside the wp-content directory to understand how it works and what you can do here.

The contents of the wp-content directory may vary between different WordPress websites. But all WordPress websites usually include:

[dir] themes
[dir] themes
[dir] uploads

WordPress stores your theme file in a directory /wp-content/themes/. You can edit a theme file, but you shouldn’t do this much. Immediately after updating your theme to a newer version, your changes will be overwritten in the updates.

This is why you should create a child theme when it comes to customizing a theme.

All WordPress themes you download and install on your website are stored in folders /wp-content/themes/. You do not have the right to edit the theme file directly unless you have written the theme for your own WordPress site only.

In many WordPress tutorials, you’ll see snippets of code to add to your website. The best way to add custom code to your WordPress site is to add the theme’s functions.php file or create a specific web theme.

WordPress stores all uploaded images and multimedia files in folders /wp-content/uploads/. By default, these uploaded files are sorted in folders /year/month/. Whenever you create a WordPress backup, you should create an upload

You can download new copies of the original WordPress, themes and theme plugins, but if you lose the upload folder it will be difficult to restore it without a backup.

Some other default directories you may see in the wp-content directory include:

  • languages ​​- Where to store language files for non-English pages
  • upgrade – This is a temporary directory created by WordPress when it is being upgraded to a newer version

Many WordPress plugins can also create their own directories within the wp-content directory. For example, we have a gallery folder created by Envira Gallery theme.

Some of those folders may contain important files just like the gallery folders may contain your gallery images. You should always back up such folders to avoid losing important data.

Other directories may contain files that you can safely delete. For example, your caching plugin, such as WP Rocket or WP Fastest Cache, can store cache files in their own directory

We have covered this article, hopefully this article will help you understand more about WordPress files and directory structure.

Leave a Reply

Your email address will not be published. Required fields are marked *

69 − = 62