Skip to content
Donner's Daily Dose of Drama
Donner's Daily Dose of Drama
  • The Good
    • Blogging
    • Consumer Protection
    • Environment
    • Ethics
    • Geek’s Home
    • Lisa Lanett
    • Medfield
    • Music
    • Parenting and Technology
    • Travel
    • wow
  • The Bad
    • Business
    • Ebay
    • Investment
    • Job search
    • Personal Finance
    • Politics
  • The Ugly
    • Information Technology
      • Business Intelligence
      • Content Management
      • Free Software
      • I18N and L10N
      • Java
      • Open Source
      • Mobile Devices
      • Open Source Business Intelligence
      • OSBI
      • SDA
      • Security
      • Smartphone
      • Software Best Practices
      • Software Engineering
      • SQL Server
      • Streaming Media
      • Web
    • Austria
    • Fiction
    • Hardware
    • iPod
    • Miscellaneous
    • Uncategorized
    • Video
    • Weekend Warrior
Donner's Daily Dose of Drama

WordPress Database Schema Frustration

Christian Donner, April 12, 2017April 12, 2017

A client reported a permissions issue with a WordPress site that I ported to Pantheon about 2 years ago. When she tried to create a new Page, an error message appeared.

Wordpress displays "Submit for Review" instead of "Publish"
“Submit for Review” instead of “Publish”

It took a few hours over the course of two days until I was able resolve this and return the site to its fully operational state. And because, as it is so often the case, I found no single source of information that helped me, here is story of how I puzzled it together from pieces.

Wordpress error message "Sorry, you are not allowed to edit this post."
Error message “Sorry, you are not allowed to edit this post.”

I began to investigate and soon noticed, that there was more wrong with the site. None of the “Add” pages worked, the editor was missing, and instead there was this weird message on the Post page when I tried to add a new Page:

You are currently editing the page that shows your latest posts.

Wordpress displays no editor, no Publish button on the Post page
No editor, no Publish button on the Post page

Where I did manage to submit a new element without getting an error (e.g. a new user), it seemed to disappear.

At this point, I was still hopeful for a quick fix, and began to search the web for occurrences of these messages. Especially the “You are currently editing the page that shows your latest posts” seemed promising. So I tried a methodical step-by-step approach.

Step 1 – Local instance

There was no local development instance because there was no development, so I had to create one. Pantheon does not let you fiddle with themes and plugins in their environment. I pulled the site and database down into a local TurnKey Linux appliance where it showed the exact same behavior.

Step 2 – Turned on Debugging and Logging

I saw database insert errors and primary key/duplicate key violations, but it took me a bit longer to find out what caused them.

Step 3 – Eliminate possible causes

I disabled all plugins and removed them from the plugin folder, switched to the twentyseventeen theme and removed all others from the themes folder. No change.

I downloaded a fresh copy of WordPress and started it with the original wp_config.php.

Step 4 – It is probably the database, but how to fix it?

Some sources reported success after installing WP-DBManager and running the repair function, but without explaining what the issue was and what the tool repaired. Some reports claimed that the problem began after the WP 4.2 update. The tool did nothing for me.

Step 5 – Get into the weeds of the WordPress database schema

I had noticed earlier that after a failed “Add Page” attempt, there was a row in the wp_posts table with post ID  of 0.

Wordpress creates empty post with ID 0
Empty post with ID 0 shows up in the database

I initially suspected a primary key or index issue, because this is what some sources claimed. I queried the data, looked for orphaned or duplicate rows, or any other oddities. You see where this is going. Then I finally came across sources that attributed this issue to a missing Auto Increment property on the primary key, which explained all the symptoms. I let WP generate a  fresh database instance and compared the schemas. And indeed, all the primary key columns in all tables were missing this setting. Because WordPress does not pass a value for the primary key on insert (I saw this in the error message on the screen), it can’t work without this.

This StackOverflow question and this one on Stackexchange were helpful in figuring out how to add the auto-increments back in. I was not able to simply add it back in, because two tables had duplicate values (0) that prevent the database from making the column increment automatically. I decided to ignore these two tables, wp_options and wp_usermeta, because they don’t seem to get referenced from other tables and I did not notice any issues with site. So here is my script that I ran remotely in the Pantheon databases (dev, test, live):

ALTER TABLE wp_termmeta AUTO_INCREMENT = 10000, MODIFY COLUMN meta_id bigint(20) unsigned NOT NULL auto_increment;
ALTER TABLE wp_terms AUTO_INCREMENT = 10000, MODIFY COLUMN term_id bigint(20) unsigned NOT NULL auto_increment;
ALTER TABLE wp_term_taxonomy AUTO_INCREMENT = 10000, MODIFY COLUMN term_taxonomy_id bigint(20) unsigned NOT NULL auto_increment;
ALTER TABLE wp_commentmeta AUTO_INCREMENT = 10000, MODIFY COLUMN meta_id bigint(20) unsigned NOT NULL auto_increment;
ALTER TABLE wp_comments AUTO_INCREMENT = 10000, MODIFY COLUMN comment_ID bigint(20) unsigned NOT NULL auto_increment;
ALTER TABLE wp_links AUTO_INCREMENT = 10000, MODIFY COLUMN link_id bigint(20) unsigned NOT NULL auto_increment;
ALTER TABLE wp_postmeta AUTO_INCREMENT = 10000, MODIFY COLUMN meta_id bigint(20) unsigned NOT NULL auto_increment;
ALTER TABLE wp_users AUTO_INCREMENT = 10000, MODIFY COLUMN ID bigint(20) unsigned NOT NULL auto_increment;
ALTER TABLE wp_posts AUTO_INCREMENT = 10000, MODIFY COLUMN ID bigint(20) unsigned NOT NULL auto_increment;

Once this ran, adding users and posts worked normally again.

Related Posts:

  • TyreWiz not working after battery change
  • My USPS Certified Mail Experience Explained
  • The Voip.ms SMS Integration for Home Assistant
  • OpenVPN
  • Computer Build 2025

Content Management Auto Increment

Post navigation

Previous post
Next post

Leave a Reply

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

Pages

  • About
  • Awards
    • TechnoLawyer
  • Contact Christian Donner
  • Project Portfolio
  • Publications
  • Speaking Engagements

Recent Comments

  • Christian Donner on Sealing a leaky cast-iron fireplace chimney damper
  • Eric on Sealing a leaky cast-iron fireplace chimney damper
  • Christian Donner on Contact Christian Donner
  • Max on Contact Christian Donner
  • Christian Donner on Contact Christian Donner

Tags

AHCI Amazon Android ASP.Net AT&T Droid Drupal email Error failure featured firmware Garmin Godaddy Google honda Internet Explorer 8 iPhone Lenovo Lisa Lanett Modules NAS Nexus One Paypal Performance Privacy QNAP raid RS-407 sauna Security spam SQL SR3600 Synology T-Mobile T430s transmission tylö Verizon Virus VMWare Windows 7 windows 8.1 Windows Mobile
  • About
  • Awards
    • TechnoLawyer
  • Contact Christian Donner
  • Project Portfolio
  • Publications
  • Speaking Engagements
©2025 Donner's Daily Dose of Drama | WordPress Theme by SuperbThemes