How to fix Wordfence Settings that are not being saved

Since discovering the wordfence plugin years ago it’s been one of the plugins I recommend, both personally and professionally, for anyone looking to secure their site.

Chances are any fresh install should just work. In my case I did a fresh install of wordpress then, using one of the migration plugins, restored my database. Somewhere along the way Wordfence reported that it was working, but 2FA and a couple login security settings refused to save. It turns out there were two tables that were missing. These tables were wfls_settings and wfls_2fa_secrets.

Note that you may need a different prefix based on how you configured your database, but you can try the following SQL statements to restore those tables if you’re experiencing a similar situation.

These tables have to be created using the INNODB engine, so if that’s not you’re default make sure to set it for these tables.

CREATE TABLE IF NOT EXISTS wp_wfls_settings (
  name varchar(191) NOT NULL DEFAULT '',
  value longblob,
  autoload enum('no', 'yes') NOT NULL DEFAULT 'yes',
  PRIMARY KEY (name)
) DEFAULT CHARSET = utf8;


CREATE TABLE IF NOT EXISTS wp_wfls_2fa_secrets (
  id int(11) unsigned NOT NULL AUTO_INCREMENT,
  user_id bigint(20) unsigned NOT NULL,
  secret tinyblob NOT NULL,
  recovery blob NOT NULL,
  ctime int(10) unsigned NOT NULL,
  vtime int(10) unsigned NOT NULL,
  mode enum('authenticator') NOT NULL DEFAULT 'authenticator',
  PRIMARY KEY (id),
  KEY user_id (user_id)
) DEFAULT CHARSET = utf8;

Post navigation