The wp_postmeta table is used to store additional information about WordPress terms (categories, tags, and custom taxonomies) besides those in wp_terms and wp_term_taxonomy tables.
For example, if a travel website has categories or custom taxonomies for different travel destinations, wp_termmeta table can store information such as GPS coordinates, airport codes, or local currency codes.
The table structure is similar to the other meta tables (wp_commentmeta, wp_postmeta, wp_usermeta).
Columns
meta_id: Auto incrementing integer ID, used as primary key. It has no other meaning.
term_id: The ID of the term (category, tag, or custom taxonomy) associated with the metadata. It is the term_id column from wp_terms table.
meta_key: The name of the metadata key. Example: "gps", "airport_code", "currency".
meta_value: The value of the metadata associated with the term, stored as serialized string. Example: "50.07,14.43" for the "gps" meta key or "PRG" for the "airport_code" meta key.
SQL Schema
CREATE TABLE `wp_termmeta` (
`meta_id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`term_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 (`meta_id`),
KEY `term_id` (`term_id`),
KEY `meta_key` (`meta_key`(191))
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;