Skip to main content Skip to course navigation

Core tables map – wp_posts, wp_postmeta, wp_options, wp_users, and wp_usermeta

So far, you have already read some real WordPress data with $wpdb and also compared that with helper functions like get_option(), get_userdata(), and get_posts().

Now the goal is to build a cleaner mental map of where data tends to live. Think of these five tables as the main map for a lot of everyday WordPress thinking:

wp_posts
This table is broader than the name suggests. It stores many content objects, not only normal blog posts. Pages, attachments, revisions, and custom post types are also stored there, with the post_type column helping distinguish what each row represents.

wp_postmeta
This table stores metadata related to posts. Metadata in WordPress is basically extra key-value data attached to an object. For posts, that means extra information attached to a post, page, attachment, or custom post type entry. WordPress provides post meta functions for working with this layer.

wp_options
This table stores site-level settings and configuration values. In normal WordPress development, these values are usually accessed through the Options API, especially get_option(), rather than direct SQL.

wp_users
This table stores core user identity data. Things like the user ID, login, email, and related core fields live there. Extra user-related information is usually stored separately in user meta.

wp_usermeta
This table stores metadata attached to users. Just like post meta stores extra data for posts, user meta stores extra data for users through key-value pairs. WordPress exposes helper functions such as get_user_meta() for this.

So the simple mental map is:

  • wp_posts = main content objects
  • wp_postmeta = extra data attached to content
  • wp_options = site and plugin settings
  • wp_users = core user identity data
  • wp_usermeta = extra data attached to users

One very important mindset point for plugin work: before creating a custom table, WordPress guidance says to consider using post meta when it is practical, and more generally to prefer core storage patterns when they fit the job. That does not mean custom tables are wrong, only that they should usually come later, not first.

This lesson matters because support and debugging often start with a question like: what kind of data is this, and where would WordPress probably store it?

That question gets much easier when you stop seeing the database as one giant blob and start seeing it as a set of storage zones.

References: