The wp_usermeta
table is used to store additional details for each user besides those stored in the wp_users
table. This can include information such as user preferences, biographical information, and other custom fields, often created and/or used by plugins or themes.
Each row corresponds to a single piece of meta data for a specific user, identified by the user_id
value. The meta_key
and meta_value
columns store the key-value meta data pairs.
The table structure is similar to the other meta tables (wp_commentmeta
, wp_postmeta
, wp_termmeta
).
Columns
umeta_id
: Auto incrementing integer ID, used as primary key. It has no other meaning.
user_id
: ID of the user to which the meta data belongs. It is the ID
column from wp_users
table.
meta_key
: The key or name used to uniquely identify each piece of user meta data for given user. For example, if you wanted to store a user's first name, the meta_key
might be "first_name".
meta_value
: Actual value of the meta data piece. For example, if the meta_key
is "first_name", the meta_value
might be "John".
SQL Schema
CREATE TABLE `wp_usermeta` (
`umeta_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`user_id` bigint(20) unsigned NOT NULL DEFAULT 0,
`meta_key` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
`meta_value` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL,
PRIMARY KEY (`umeta_id`),
KEY `user_id` (`user_id`),
KEY `meta_key` (`meta_key`(191))
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;