🔧 The Byline That Followed the Wrong Author Home
Migrating a WordPress site to a new database – a new host, a staging-to-production move, a restore from a backup taken on a different server – and finding posts now crediting the wrong author is rarely about the post content being altered at all. WordPress stores a post’s author as a numeric user ID, not a name, and every post simply looks up whichever user currently has that ID to decide whose byline to show; if the new database’s wp_users table assigns IDs in a different order (a fresh WordPress install’s default admin account taking ID 1, for instance, when the original site’s ID 1 belonged to a completely different person), every post written by the original ID 1 now displays whoever happens to hold that same number on the new installation.
🔎 The Problem
-- Original site: ID 1 = "Jane Editor", who wrote most of the posts -- New install (migrated separately, users re-created manually): -- ID 1 = "admin" (WordPress's own default first-created account) -- Every post's byline is driven by this stored reference, not by -- a name: SELECT ID, post_title, post_author FROM wp_posts LIMIT 3; -- post_author column holds a raw user ID - "1" - with zero -- indication, from the posts table alone, of which actual person -- that number was supposed to mean on the ORIGINAL site. -- The byline shown on the front end is purely a live lookup: SELECT display_name FROM wp_users WHERE ID = 1; -- "admin" - and every single post stored with post_author = 1 -- now credits "admin" instead of Jane, with no content on any -- individual post actually having changed at all.
✅ Fix: Re-Point Each Post at the Correct User ID on the New Database
- Checking the original site’s wp_users table (from a backup, or the old live site if still accessible) to build a clear mapping of ‘old user ID -> person’s actual name’ is the essential first step – without that reference, there’s no way to know which ID a given post was really supposed to credit.
- Using a plugin built for bulk-reassigning post authorship (many admin-UI options exist, letting multiple posts currently attributed to one user ID be reassigned to the correct one in bulk) avoids editing post_author values directly in the database, which is faster to get wrong than to get right by hand.
- For a one-time migration cleanup, carefully running a direct UPDATE against wp_posts.post_author (matched against the specific old-ID-to-new-ID mapping built in the first step, and only after a fresh backup) corrects every affected post in one pass rather than one at a time through the admin UI.
⚠️ Why This Is Easy to Miss During a Migration
- Nothing about a mis-attributed byline throws an error or looks broken on the page – it’s a completely valid author showing a completely valid name, just not the one that post was actually written by, which means this specific kind of mistake is caught by a human noticing, not by anything automated.
- User accounts are very rarely migrated with the same care taken for post content and media – it’s common for the people doing a migration to re-create user accounts manually on the new site without preserving the exact same ID-to-person mapping the old site had, which is precisely the gap this bug lives in.
WordPress never actually forgets who wrote a post – it just remembers them by a number, and a migration that changes what that number means changes every byline in the database at once.
