Diagnosing and Recovering a Corrupted WordPress Installation

WordPress
Debugging
Databases
Technical SEO
At a glance

Vivir Europa, my own travel site

Debugging · database forensics · isolation testing · recovery

Content creation failing · comments missing · wp-admin locked

Live site, no staging, ambiguous evidence

Documented sequence

≈4.5h from first symptom to confirmed recovery

The problem

Every error blamed a different plugin

Error en la base de datos de WordPress:
[Duplicate entry '0' for key 'PRIMARY']

The first recorded database error. New records were being created with ID 0, colliding with each other.

Why it was genuinely tricky

The stack traces were symptoms, not causes

Stack traces
WPForms · WP Rocket · Ad Inserter

Shared state
database schema + locale option

Every trace named a different plugin. The fault lived in state they all shared.

The approach

Eliminate variables until the fault has nowhere left to hide

Object of class stdClass could not be converted to string
wp-includes/l10n.php:959

The fatal that survived every plugin being disabled: the proof the problem was in shared WordPress state, not in any of the plugins the stack traces had named.

UPDATE wp_options
SET option_value = ''
WHERE option_name = 'WPLANG';

The one-line fix, once four hours of elimination had proven where the fault actually lived.

The documented sequence

19:36First recorded symptom: WordPress cannot create pages or posts

19:56Debugging enabled; duplicate-ID database errors surface through WPForms’ scheduler

20:20wp_posts identifier defect repaired; content creation restored; wp_comments repaired next

20:56wp-admin locks out; a fatal error appears, first blaming WP Rocket, later Ad Inserter

21:08Previous-day backup restored; the fatal survives it

23:55All plugins, cache, and rewrite rules disabled; the fatal persists in WordPress core’s localisation path

23:56Invalid locale state reset with a one-line UPDATE

00:07Recovery confirmed: front end and wp-admin working; plugins reintroduced gradually next morning

Times are documented conversation timestamps (UTC) from the incident record, not uptime monitoring.

What changed
ScenarioBeforeAfter
Content creationEvery new page or post failed with a duplicate-ID collisionWorking, identifier generation repaired in wp_posts
CommentsPending comments invisibleComments table repaired with the same fix
Site accessFatal error on front end and wp-adminBoth restored after resetting invalid locale state
DiagnosisThree plugins blamed by stack tracesAll three cleared by isolation; fault located in shared state
What I deliberately did not do

Tempting moves, set aside on purpose:

01Reinstalling whichever plugin the latest stack trace blamed

02Deleting data or tables “to start clean”

03Stopping at the first plausible culprit

04Claiming a root cause the evidence doesn’t support

The investigation recovered the installation without conclusively determining what originally corrupted the schema and locale state. Saying so is part of the diagnosis: knowing what you haven’t proven is what stops you breaking things twice.

My role: debugging configuration · database schema forensics · isolation testing across plugins, cache, and rewrite rules · recovery execution · staged reactivation

Every stack trace named a different plugin. The fault lived in state they all shared.

WordPress failing with errors that blame a different plugin every time?

Get in touch