Lesson 36 of 50
72% Complete
72%

WordPress File Structure

WordPress is built using PHP, HTML, CSS, JavaScript and a database. Its files and folders work together to display pages, manage content, load themes and provide additional functionality through plugins.

Learning Objective: Understand the main WordPress folders and files, learn the purpose of wp-admin, wp-content and wp-includes, and identify where themes, plugins and uploaded media are stored.

1. What Is WordPress File Structure?

WordPress file structure is the organization of files and directories that make a WordPress website work. Each folder contains files for specific responsibilities.

Example
When you install a WordPress theme, its files are generally stored inside the wp-content/themes/ directory. When you install a plugin, its files are generally stored inside wp-content/plugins/.

2. Main WordPress Directory Structure

A standard WordPress installation contains several important folders and files. Your installation may include additional files depending on the hosting environment, plugins and configuration.

WordPress Directory Tree
wordpress/
│
├── wp-admin/
│
├── wp-content/
│   ├── plugins/
│   ├── themes/
│   ├── uploads/
│   └── languages/
│
├── wp-includes/
│
├── index.php
├── wp-config.php
├── wp-load.php
├── wp-login.php
├── wp-settings.php
├── wp-blog-header.php
├── wp-cron.php
├── xmlrpc.php
├── readme.html
└── license.txt

This is a simplified illustration of a typical WordPress installation, not a complete list of every file.

3. The wp-admin Folder

The wp-admin directory contains many files used by the WordPress administration area. These files support dashboard operations such as managing posts, pages, users and settings.

Purpose of wp-admin
  • Supports the WordPress dashboard.
  • Provides administration interfaces.
  • Supports management of posts and pages.
  • Supports user and settings management.
Important: Do not directly edit or delete core files in wp-admin. Doing so can break the administration area or create security problems.

4. The wp-content Folder

The wp-content directory is one of the most important directories for website customization. It normally contains themes, plugins and uploaded media.

Inside wp-content
wp-content/
│
├── plugins/
│   ├── example-plugin/
│   └── another-plugin/
│
├── themes/
│   ├── example-theme/
│   └── example-child-theme/
│
├── uploads/
│   ├── 2026/
│   │   ├── 01/
│   │   └── 02/
│
└── languages/

The folder names shown are examples. The actual directory contents depend on the website's setup.

5. The plugins Folder

The wp-content/plugins/ directory stores plugin files. Plugins extend WordPress with additional features.

Examples of Plugin Features
  • Contact forms
  • SEO tools
  • Backup tools
  • Security features
  • Online store functionality

A plugin must be compatible and appropriately configured. Simply placing files in this folder does not guarantee that a plugin will work.

6. The themes Folder

The wp-content/themes/ directory stores WordPress theme files. A theme controls much of the website's presentation, including templates, styles and design features.

Example Theme Structure
my-business-theme/
│
├── style.css
├── functions.php
├── index.php
├── header.php
├── footer.php
├── single.php
├── page.php
└── assets/
    ├── css/
    ├── js/
    └── images/

This is an illustrative classic-theme structure. Block themes may instead use files such as theme.json and HTML templates inside a templates/ directory.

7. The uploads Folder

The wp-content/uploads/ directory commonly stores media uploaded through the WordPress Media Library, such as images, PDFs and other supported files.

Example Upload Directory
uploads/
│
├── 2026/
│   ├── 01/
│   │   ├── company-logo.png
│   │   └── course-image.jpg
│   │
│   └── 02/
│       └── brochure.pdf

WordPress commonly organizes uploads by year and month when that setting is enabled. Other configurations may use a different arrangement.

8. The wp-includes Folder

The wp-includes directory contains many WordPress core libraries, functions and classes used throughout the system.

What wp-includes Supports
  • Core WordPress functions and classes
  • Template-related functions
  • Formatting and utility functions
  • Core libraries and other system components
Security Tip: Never delete or casually modify files in wp-includes. These files are part of WordPress core. Use supported themes, plugins and hooks for customization.

9. Important WordPress Root Files

File Purpose
index.php Provides an important entry point for loading WordPress.
wp-config.php Contains site configuration, including database connection settings and security keys.
wp-load.php Loads the WordPress environment.
wp-login.php Handles the standard WordPress login interface and related authentication requests.
wp-settings.php Initializes much of the WordPress environment.
wp-blog-header.php Loads the WordPress environment and initiates the main query for front-end requests.
wp-cron.php Runs scheduled WordPress tasks when triggered.
xmlrpc.php Provides the legacy XML-RPC interface when enabled and available.

10. Understanding wp-config.php

The wp-config.php file contains important configuration values for WordPress. It commonly includes database connection details and security keys.

Simplified Configuration Example
<?php

define('DB_NAME', 'wordpress_db');
define('DB_USER', 'your_database_user');
define('DB_PASSWORD', 'your_database_password');
define('DB_HOST', 'localhost');

// Other WordPress configuration values follow.

This is a simplified illustration, not a complete production configuration. Use the correct credentials provided by your development or hosting environment.

Never share database passwords or secret keys. Protect wp-config.php using suitable server permissions and hosting security practices. Do not copy real credentials into tutorials or public repositories.

11. Where Is WordPress Content Stored?

WordPress uses both files and a database. They serve different purposes.

Files and Folders
Themes, plugins, uploaded media, PHP source files, stylesheets, scripts and other assets are stored in the filesystem.
Database
Posts, pages, many settings, user records, comments and other WordPress data are stored in the database.

For a complete backup, you generally need both the relevant WordPress files and a database backup. Back up any additional external storage or configuration your website depends on.

12. How to Access WordPress Files

The method depends on whether WordPress runs on your computer or on a hosting server.

Localhost
If you use a local development environment, open its web root directory. For example, a common XAMPP installation uses:
C:\xampp\htdocs\wordpress\
Your exact path may differ based on where you installed XAMPP and WordPress.
Web Hosting
Use your hosting provider's file manager or an authorized SFTP connection. Locate the directory where WordPress is installed before making changes.

13. Safe WordPress File Management

Best Practices
  • Back up files and the database before major changes.
  • Use a staging environment to test code changes.
  • Avoid modifying WordPress core files.
  • Use a child theme when customizing a classic theme.
  • Use supported hooks or a custom plugin for site functionality.
  • Keep file permissions appropriate for your server.
  • Keep WordPress core, themes and plugins updated.
  • Never expose configuration files or credentials publicly.

14. Practical Assignment

Activity: Explore WordPress Files

Complete these tasks using your local or test WordPress installation:

  1. Locate the main WordPress installation directory.
  2. Identify the wp-admin folder.
  3. Open wp-content and locate the plugins folder.
  4. Locate the themes folder.
  5. Open the uploads folder and identify a sample media file.
  6. Locate wp-includes.
  7. Identify wp-config.php without sharing its contents.
  8. Write down the purpose of five important WordPress files.
  9. Explain why WordPress files and the database both need to be backed up.
Do not delete, rename or edit core files during this exercise. Simply inspect the directory structure.

Lesson Summary

  • wp-admin supports the administration area.
  • wp-content contains themes, plugins and uploads.
  • wp-includes contains WordPress core libraries and functions.
  • wp-config.php contains important site configuration.
  • The filesystem stores themes, plugins and media files.
  • The database stores posts, pages, users and other site data.
  • Safe backups include both files and the database.
  • Use supported customization methods rather than editing core files.

Lesson 36 Quiz

Choose the correct answer for each question.

Q1. Which folder normally stores WordPress themes and plugins?
Q2. What is the main purpose of wp-config.php?
Q3. What should a complete WordPress backup normally include?