WordPress Database Tables
What WordPress Keeps in Its Database
The WordPress database tables are the structured storage where a site keeps its content and most of its settings. Posts, page text, user accounts and comments live in the database, while code and uploaded files live in the file system. Each table holds one kind of record, and by default the table names begin with the prefix wp_.
When a visitor requests a page, WordPress reads several tables: it finds the content, reads the related details and settings, and passes the results to the theme to build the page. The general architecture is explained in the how a CMS works article.
The Core Tables and What They Hold
wp_postsstores posts, pages, media entries, revisions and custom content types.wp_postmetastores extra details for posts as key and value pairs, including custom field data.wp_usersandwp_usermetastore account records and extra profile data such as roles and preferences.wp_terms,wp_term_taxonomyandwp_term_relationshipsstore categories, tags and the links between them and content.wp_optionsstores site-wide settings, including many written by themes and plugins.wp_commentsandwp_commentmetastore comments and their extra details.
Why Autoloaded Options and Leftover Data Matter
Each row in wp_options has an autoload setting. Entries marked to autoload are loaded on every page request, so a large amount of autoloaded data slows every visit, even when a particular page does not need it.
Plugins often add rows or tables when they are installed. Some remove their data when deleted and others leave it behind. Over time, unused rows accumulate, which increases database size and the work needed to read it. This is one reason the number of plugins matters, as explained in the plugin bloat article.
For example, a site that used a large plugin years ago may still hold that plugin’s settings in wp_options. The data is invisible in the admin area, yet if it is autoloaded, it is still read on every request.
Frequently asked questions
Can I edit the WordPress database directly?
You can, but direct edits are risky. A wrong change to wp_options or wp_posts can break a site, and WordPress does not check manual edits. Most changes are better made through the admin area, the theme or a plugin, and any direct change should follow a verified backup.
Does the database store my images?
The database stores a record for each image, including its title, alt text and file path. The image files themselves are kept in the wp-content/uploads folder, described in the file structure article. Both parts are needed, so a backup must include the database and the files together.