Recreate `wc_admin_notes` and `wc_admin_note_actions` Database tables
  • Missing wc_admin_notes and wc_admin_note_actions tables
  • WordPress database error Unknown column one of the columns in field list for query.

If you’re noticing similar errors with WooCommerce (WooCommerce Admin), you can use the instructions below to delete and re-create wc_admin_notes and wc_admin_note_actions Database tables:

This is a Developer level article. If you are unfamiliar with code/development, and resolving potential conflicts, please reach out to a developer for assistance.

Before you proceed, please make sure that you have a complete backup of your store including the database. Your web host can help with that.

These queries assume you’re using the default wp_ database prefix. You’ll want to replace all instances of wp_ with the database prefix on your store if you’re using a different prefix.

MySQL Queries:

To delete the faulty columns:

DROP TABLE IF EXISTS `wp_wc_admin_notes`;
DROP TABLE IF EXISTS `wp_wc_admin_note_actions`;

To create wp_wc_admin_notes

CREATE TABLE `wp_wc_admin_notes` (
  `note_id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `type` varchar(20) NOT NULL,
  `locale` varchar(20) NOT NULL,
  `title` longtext NOT NULL,
  `content` longtext NOT NULL,
  `icon` varchar(200) NOT NULL DEFAULT 'info',
  `content_data` longtext DEFAULT NULL,
  `status` varchar(200) NOT NULL,
  `source` varchar(200) NOT NULL,
  `date_created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `date_reminder` datetime DEFAULT NULL,
  `is_snoozable` tinyint(1) NOT NULL DEFAULT 0,
  `layout` varchar(20) NOT NULL DEFAULT '',
  `image` varchar(200) DEFAULT NULL,
  `is_deleted` tinyint(1) NOT NULL DEFAULT 0
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
ALTER TABLE `wp_wc_admin_notes`
  ADD PRIMARY KEY (`note_id`);
ALTER TABLE `wp_wc_admin_notes`
  MODIFY `note_id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;
COMMIT;

To create wp_wc_admin_note_actions

CREATE TABLE `wp_wc_admin_note_actions` (
  `action_id` bigint(20) UNSIGNED NOT NULL,
  `note_id` bigint(20) UNSIGNED NOT NULL,
  `name` varchar(255) NOT NULL,
  `label` varchar(255) NOT NULL,
  `query` longtext NOT NULL,
  `status` varchar(255) NOT NULL,
  `is_primary` tinyint(1) NOT NULL DEFAULT 0,
  `actioned_text` varchar(255) NOT NULL,
  `nonce_action` varchar(255) DEFAULT NULL,
  `nonce_name` varchar(255) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
ALTER TABLE `wp_wc_admin_note_actions`
  ADD PRIMARY KEY (`action_id`),
  ADD KEY `note_id` (`note_id`);
ALTER TABLE `wp_wc_admin_note_actions`
  MODIFY `action_id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;
COMMIT;

Leave a Reply

Your email address will not be published. Required fields are marked *