Same option_id=0 for 2 options in wp_options?

If we check how the wp_options table is created (in 4.4) from the schema.php file, we will find the following:

CREATE TABLE $wpdb->options (
  option_id bigint(20) unsigned NOT NULL auto_increment,
  option_name varchar(191) NOT NULL default '',
  option_value longtext NOT NULL,
  autoload varchar(20) NOT NULL default 'yes',
  PRIMARY KEY  (option_id),
  UNIQUE KEY option_name (option_name)
) $charset_collate;

Here’s how this structure looks like for the wp_options table:

> DESCRIBE wp_options;
+--------------+---------------------+------+-----+---------+----------------+
| Field        | Type                | Null | Key | Default | Extra          |
+--------------+---------------------+------+-----+---------+----------------+
| option_id    | bigint(20) unsigned | NO   | PRI | NULL    | auto_increment |
| option_name  | varchar(191)        | NO   | UNI |         |                |
| option_value | longtext            | NO   |     | NULL    |                |
| autoload     | varchar(20)         | NO   |     | yes     |                |
+--------------+---------------------+------+-----+---------+----------------+

If this happened just recently you should check your error logs for PHP, MySQL, NginX/Apache.

Not sure what your MySQL version is, but the recommended version is 5.6+ but should work on 5.0+.

Make sure the table structure of the other core tables is intact as well.

Remember to backup your database before altering the table structure.

Leave a Comment