The preview works fine, it's just that changes are not applied, I guess it should be cause an database error.

I recently migrated the website from a hosting to a VPS and the SQL import gave me some errors, the whole database size in .sql is 270MB with 88027 entries in wp_posts

Most of the tables after the importation lack of primary key and there were multiple rows with ID 0, I already "fixed" it deleting these rows (they all seemed to be irrelevant) and setting primary key to every table.

It didn't fixed my issue so I tried now repairing database with WordPress, defining wp_allow_repair to wp-config.php and going to wp-admin/maint/repair.php, neither worked so I repaired every table from PHPMyAdmin, again, neither worked.

I also tried overwriting all wordpress files but no luck.


.[Thu Feb 23 15:32:13 2017] [error] [client xxx.xxx.xxx.xxx] WordPress database error Duplicate entry '0' for key 'PRIMARY' for query INSERT INTO wp_posts (post_author, post_date, post_date_gmt, post_content, post_contet_filtered, post_title, post_excerpt, post_status, post_type, comment_status, ping_status, post_password, post_name, to_ping, pinged, post_modified, post_modified_gmt, post_parent, menu_order, post_mme_type, guid) VALUES (1, '2017-02-23 14:32:12', '0000-00-00 00:00:00', '{\n \"generate_settings[post_content]\": {\n \"value\": \"excerpt\",\n \"type\": \"option\",\n
\"user_id\": 1\n }\n}', '', '', '', 'auto-draft', 'customize_changeset', 'closed', 'closed', '', '8039b052-4558-4b93-ad93-debbb7a2b103', '', '', '2017-02-23 14:32:12', '0000-00-00 00:00:00', 0, 0, '', '') made by do_action('wp_ajax_customize_sve'), WP_Hook->do_action, WP_Hook->apply_filters, call_user_func_array, WP_Customize_Manager->save, WP_Customize_Manager->save_changeset_post, wp_insert_post, referer: https://domain.com/wp-admin/customize.php?return=%2Fwpadmin%2F&changeset_uuid=8039b052-4558-4b93-ad93-debbb7a2b103

  • 1
    unlikely to be related to anything in your DB. check you php error log – Mark Kaplun Feb 23 '17 at 12:58
  • Right, forgot to check it, there is what it throws – Mc Kernel Feb 23 '17 at 14:42
  • seems like a bug with the costumizer changeset feature. I changed the tag to hopefully get weston notified of this question, but you might want to open a bug in wordpress bug trac for it. – Mark Kaplun Feb 23 '17 at 16:13

Damn, the error was pretty intuitable: most tables in my database lacked of AUTO_INCREMENT

Since ID is not defined in the INSERT query, it will be 0 unless AUTO_INCREMENT is setted to ID.

So I just fixed it by setting AUTO_INCREMENT

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.