WordPress Files and Database: A Beginner’s Overview

Wordpress Manual WordPress Fundamentals Toggle WordPress Fundamentals section What Is WordPress? WordPress.org vs WordPress.com What Can You Build with WordPress? How WordPress Works WordPress Core, Themes, Plugins and Content Essential WordPress Terminology How to Plan a WordPress Website Domains, Hosting, DNS and HTTPS Explained How to Choose WordPress Hosting Development, Staging and Production Environments How…

5 min read

  • Article
  • Beginner
  • 5 minutes read
  • Reviewed August 3, 2026

A WordPress website is not contained entirely in its files or entirely in its database.

The complete installation combines code, uploaded assets, configuration and structured database records. Understanding this division is essential for backups, migrations, debugging and security.

What Is Stored in WordPress Files?

Files normally contain:

  • WordPress core code.
  • Themes.
  • Plugins.
  • Must-use plugins.
  • Uploaded media.
  • Configuration files.
  • Server rules.
  • Language files.
  • Cache and generated files.
  • Custom code and assets.

The exact structure can vary by host and project.

The WordPress Root Directory

The root directory contains WordPress files and folders.

Common entries include:

  • wp-admin
  • wp-includes
  • wp-content
  • wp-config.php
  • index.php
  • .htaccess on some Apache configurations
  • Other WordPress core files

Do not edit core files for customization.

The wp-admin Directory

wp-admin contains code used by the WordPress administration area.

It is part of core and is replaced or updated during WordPress updates.

Custom administration functionality belongs in plugins or other supported extension points, not through direct edits here.

The wp-includes Directory

wp-includes contains core libraries, APIs, classes and functions used throughout WordPress.

Like wp-admin, it is managed by WordPress updates and should not be customized directly.

The wp-content Directory

wp-content contains much of the website-specific file content.

Typical subdirectories include:

  • themes
  • plugins
  • mu-plugins
  • uploads
  • languages
  • Cache or plugin-generated directories

Because it contains themes, plugins and media, wp-content is a critical part of backup and migration.

The directory name and location can be customized, but most installations use the default.

Themes

Each installed theme normally has a directory inside wp-content/themes.

Theme files may include:

  • Templates.
  • Stylesheets.
  • JavaScript.
  • Images and fonts.
  • theme.json.
  • PHP functions.
  • Block patterns and template parts.

A child theme stores customizations separately from its parent theme so parent updates do not overwrite them.

Plugins

Plugins normally live in wp-content/plugins.

A plugin can include PHP, JavaScript, CSS, templates, assets and build files.

Deleting a plugin directory removes its code, but it does not necessarily remove data the plugin stored in the database or uploads directory.

Must-Use Plugins

Must-use plugins live in wp-content/mu-plugins and load automatically.

They may not appear in the normal plugin list in the same way as regular plugins, so remember to inspect them during troubleshooting or migration.

Uploads

Uploaded media normally lives under wp-content/uploads.

WordPress often organizes files by year and month, depending on configuration.

The database stores attachment records and metadata that refer to these files. Copying only the uploads directory does not recreate captions, alternative text, relationships or all generated metadata.

The wp-config.php File

wp-config.php contains fundamental configuration, including:

  • Database connection values.
  • Security keys and salts.
  • Table prefix.
  • Debug settings.
  • Environment-specific constants.
  • Other advanced configuration.

It contains sensitive information and should be protected.

Avoid sharing it in support screenshots, public repositories or unsecured messages.

Server Configuration Files

The server may use files such as .htaccess or Nginx configuration outside the WordPress directory.

These can control:

  • Rewrite rules.
  • Redirects.
  • Access restrictions.
  • Caching.
  • Security headers.
  • PHP behavior.

A migration may require more than copying the visible WordPress directory if important server configuration exists elsewhere.

What Is Stored in the Database?

The database stores structured records used by WordPress and plugins.

Common data includes:

  • Posts and pages.
  • Custom post type records.
  • Revisions.
  • Navigation items.
  • Post metadata and custom field values.
  • Categories, tags and taxonomy terms.
  • Users and user metadata.
  • Comments and comment metadata.
  • Website options.
  • Plugin settings.
  • Theme settings.
  • Scheduled events.
  • Ecommerce, form or membership data added by plugins.

Default WordPress Tables

A standard installation includes tables for:

  • Posts.
  • Post metadata.
  • Terms and taxonomies.
  • Users and user metadata.
  • Comments and comment metadata.
  • Options.
  • Links, retained mainly for compatibility.

The table prefix is often wp_, but it can be changed.

Plugins may create additional tables or store data in existing WordPress tables.

Content Is Often Split Across Several Records

A single page can involve:

  • A post record for title and main content.
  • Post metadata for additional fields.
  • Taxonomy relationships.
  • Attachment records for media.
  • Options for global configuration.
  • Plugin-specific data.

This is why copying a single database row rarely reproduces a complete content item.

Files and Database Depend on Each Other

Examples of the relationship include:

  • The database says which theme is active; theme code lives in files.
  • The database stores attachment information; the media file lives in uploads.
  • The database stores plugin settings; plugin code interprets them.
  • A post contains block markup; theme and plugin styles determine its appearance.
  • Rewrite configuration is stored in WordPress, while server rules route requests.

A mismatch can cause broken pages, missing media, plugin errors or incorrect settings.

Why a Complete Backup Needs Both

A database-only backup may preserve content and settings but not uploaded media, custom themes or plugin code.

A files-only backup may preserve code and media but not current content, users, orders or configuration.

A complete recovery plan normally includes:

  • Database backup.
  • Website files.
  • Server or environment configuration where required.
  • External service configuration.
  • Encryption keys and credentials stored securely.
  • A documented restoration process.

Migrations and Search-Replace

WordPress stores URLs and other environment-specific values in the database.

Moving to a new domain or protocol can require a serialization-aware search-and-replace process.

Do not use a simple text replacement on a database dump without understanding serialized data. Use established WordPress tools and create a backup first.

Generated and Disposable Files

Some files can be regenerated:

  • Page cache.
  • Minified assets.
  • Image thumbnails in some workflows.
  • Temporary exports.
  • Logs.

Do not assume every generated file is safe to delete. Confirm the purpose and plugin behavior.

Frequently Asked Questions

Are posts stored as files?

Normally no. Posts and pages are stored in the database, while uploaded media and code are stored in files.

Can I back up only wp-content?

It protects many site-specific files but not the database or all server configuration. It is not a complete website backup.

Does deleting a plugin delete its data?

Not necessarily. Some plugins remove data during uninstall; others preserve it. Check the plugin documentation and uninstall behavior.

Can I edit the database directly?

It is possible but risky. Use WordPress interfaces, APIs or migration tools when available, and always create a backup first.

Continue Learning

Previous: Essential WordPress Settings After Installation

Next: WordPress Versions, Updates and Release Cycles