Key takeaways
- WordPress keeps almost everything in a MySQL or MariaDB database: content, settings, users, categories and tags. Uploaded files and the code of themes and plugins live on the server’s file system.
- A standard single-site installation creates twelve core tables, each with a prefix, wp_ by default.
- Pages, posts and navigation menu items share one table, wp_posts; their extra details live in wp_postmeta. Settings live in wp_options.
- Categories and tags are spread over three term tables, which is what lets one system handle any kind of grouping.
- Because content and files live in different places, a complete backup always needs both: the database and the wp-content folder.
When you publish a page in WordPress, no file is created for it. The words, the title, the date and the settings are written as rows in a database, and every time someone visits, WordPress reads those rows back and builds the page. Understanding that database explains a lot: why backups have two halves, why some plugins leave clutter behind, and why changing a theme never touches your content.
This article explains how the WordPress database is organized. It is part of our guide How WordPress Works.
What lives in the database, and what does not
WordPress database
The MySQL or MariaDB database where WordPress stores a site’s content, settings, users and taxonomies. Its structure is created by WordPress on installation and extended by plugins.
| In the database | On the file system |
|---|---|
| Pages, posts and their revisions | WordPress core files |
| Settings and options | Themes and plugins |
| Users and their profiles | Uploaded images and documents |
| Categories, tags and other taxonomies | The configuration file, wp-config.php |
| Comments | Caches and logs, if any |
| Menu items, and templates and styles edited in the Site Editor |
Uploaded images are an interesting case: the file itself lives in the uploads folder, while a row in the database describes it and records its sizes, title and alternative text.
WordPress.org recommends MySQL 8.0 or MariaDB 10.11 or greater for the database. We describe the rest of the server in The WordPress Hosting Stack.
The twelve core tables
The WordPress database description lists twelve tables in a standard single-site installation:
| Table | What it stores |
|---|---|
| wp_posts | Content: posts, pages, navigation menu items and other post types |
| wp_postmeta | Extra details attached to content |
| wp_options | Site settings and data stored by plugins and themes |
| wp_users | User accounts |
| wp_usermeta | Extra details attached to users |
| wp_terms | Categories, tags and other terms |
| wp_term_taxonomy | Which taxonomy each term belongs to |
| wp_term_relationships | Which content belongs to which terms |
| wp_termmeta | Extra details attached to terms |
| wp_comments | Comments |
| wp_commentmeta | Extra details attached to comments |
| wp_links | The old Links feature, now hidden by default |
The wp_ prefix is the default, set in wp-config.php. Many installations use a different prefix, which lets several sites share one database without their tables colliding.
One table for all content
The most important design decision in the database is that all content shares one table. A post, a page and a menu item are all rows in wp_posts, told apart by a post type column. Each row holds the title, the content, the slug, the author, the dates and the status, such as published, draft or scheduled.
That single table is what makes WordPress flexible. A plugin that adds products, events or case studies does not need new tables: it registers a new post type and its content goes into wp_posts alongside everything else. We explain post types in Custom Post Types and Taxonomies.
The content column holds the page body. Since WordPress 5.0, that body is made of blocks stored as HTML with comments that name each block, which we explain in How WordPress Stores Blocks.
Metadata: details without new columns
The four meta tables, for posts, users, terms and comments, store extra details as name and value pairs. A product’s price, a page’s chosen template or an SEO title can all be stored as post metadata without changing the structure of wp_posts.
The flexibility has a cost. Searching or sorting by metadata is slower than using a proper column, so sites that store large amounts of data in metadata, and query it often, can slow down as they grow.
Settings: wp_options
wp_options holds the site’s settings: its name, its address, the active theme, the list of active plugins and the options on every settings screen. Plugins and themes store their own settings there too.
Some options are marked to load automatically on every request, which keeps settings fast to read. When plugins store large amounts of data that loads on every request, or leave their options behind after they are deleted, wp_options can grow large and slow every page slightly. It is one of the first places to look when an old site feels sluggish.
Taxonomies: grouping content
Categories and tags look simple in the admin area, but in the database they use three tables. wp_terms holds the names, wp_term_taxonomy says which taxonomy each term belongs to, such as category or tag, and wp_term_relationships connects content to terms.
That design lets WordPress handle any kind of grouping, not just categories and tags. A shop’s product categories or a recipe site’s cuisines use exactly the same tables.
What this means in practice
Backups need both halves. A database backup without the wp-content folder loses your images, themes and plugins; a file backup without the database loses your content. Every backup routine has to cover both.
Changing the theme does not touch content. Content lives in wp_posts, not in the theme, which is why you can redesign a site without rewriting it. What can be lost are things the old theme stored in its own options or registered itself.
Moving a site means moving the database. Migrations copy the database and the files, then update the site address stored in the options and in the content.
Plugins leave traces. Deleting a plugin removes its files, but not always its options, metadata or custom tables. Well-built plugins clean up after themselves when they are deleted.
The database is the site. Hosting, themes and plugins can all be replaced. The database, and the uploads folder that goes with it, is what makes your site yours.
Frequently asked questions
What database does WordPress use?
WordPress uses MySQL or MariaDB. WordPress.org recommends MySQL 8.0 or MariaDB 10.11 or greater.
How many tables does WordPress have?
A standard single-site installation has twelve core tables. Plugins often add their own, and multisite networks add more.
Where are WordPress pages stored?
In the wp_posts table, alongside posts and menu items, with extra details in wp_postmeta. Each row holds the title, content, slug, dates and status.
Are images stored in the database?
No. Image files are stored in the uploads folder on the server. The database stores a record for each image with its details and the sizes WordPress created.
What is wp_options used for?
It stores the site’s settings, such as its name, address, active theme and active plugins, along with settings saved by plugins and themes.

