public static function create_table()
{
global $wpdb;
$tables = $wpdb->get_results('SHOW TABLES LIKE "' . $wpdb->prefix . 'termmeta"');
if (!empty($tables)) {
return;
}
$charset_collate = '';
if (!empty($wpdb->charset)) {
$charset_collate = 'DEFAULT CHARACTER SET ' . $wpdb->charset;
}
if (!empty($wpdb->collate)) {
$charset_collate .= ' COLLATE ' . $wpdb->collate;
}
$wpdb->query('CREATE TABLE ' . $wpdb->prefix . 'termmeta (
meta_id bigint(20) unsigned NOT NULL auto_increment,
term_id bigint(20) unsigned NOT NULL default "0",
meta_key varchar(255) default NULL,
meta_value longtext,
PRIMARY KEY (meta_id),
KEY term_id (term_id),
KEY meta_key (meta_key)
) ' . $charset_collate . ';');
}