Recreate WordPress table termmeta

After reviewing a few unknown log messages I discovered that from time to time, WordPress may fail to completely upgrade it’s database during many years of upgrades. One such anomoly is with the “termmeta” tables as currently defined in WordPress.

You can create or recreate these tables using the following SQL.

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,
PRIMARY KEY (`meta_id`),
KEY `term_id` (`term_id`),
KEY `meta_key` (`meta_key`(191))
) ENGINE=InnoDB AUTO_INCREMENT=3255 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

A PHP version was also located for a perhaps more thorough update.

Leave a Reply